python下打开所在文件夹下的文件应该如何写

哊點壞 1个月前 已收到1个回答 举报

停停想想 1星

共回答了171个问题采纳率:91.6% 评论

两种解决方法:

一是改变环境目录为text文本所在路径:import ospath = r"D:\temp\church"os.chdir(path)二是直接写好文本路径:in_text = r"D:\temp\church\beijing.txt"

7小时前

22
可能相似的问题

热门问题推荐

Copyright © 2024 微短问答 All rights reserved. 粤ICP备2021119249号 站务邮箱 service@wdace.com