Python文件与异常学习笔记

上传:xutao65749 浏览: 16 推荐: 0 文件:PDF 大小:39.71KB 上传时间:2020-12-30 06:11:32 版权申诉
"""文件路径""" # 相对文件路径(适用于打开位于不同文件夹的文件) with open(r'1\temp.py') as file_object: # 运用方法read读取整个文件 contents = file_object.read() print(contents.strip(), end='') # 绝对文件路径(完整路径,任何位置,较麻烦) file_path = r'C:\Users\user\Desktop\pi_digits.txt' with open(file_path) as file_object: contents = file_
上传资源
用户评论