Python提示​<

Python提示​<,第1张

file = open(r'C://Users/86175/Desktop/test.txt',"r",encoding="utf-8")
print(file)

输出后显示

<_io.TextIOWrapper name='C://Users/86175/Desktop/test.txt' mode='r' encoding='utf-8'>

要读取里面的内容   要把file改为file.read()

file = open(r'C://Users/86175/Desktop/test.txt',"r",encoding="utf-8")
print(file.read())

即可输出内容

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/730934.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-27
下一篇 2022-04-27

发表评论

登录后才能评论

评论列表(0条)

保存