python实例练习00001:打开文件输出文件内容
try:
file = input('enter the file :')
with open(file, 'r') as f:
data = f.read()
print(data)
except FileNotFoundError:print(f'the file {file} does not exists:')
打开windows的cmd运行程序,效果如下:
原文地址:https://blog.csdn.net/tankeven/article/details/140452050
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!