使用文件功能时出现错误信息

问题描述

这是怎么回事?我尝试在函数中读取我的txt文件。:

def vragen_ophalen():
    text_file = open("vragen.txt","r")
    print(text_file.read())



def main():
    vragen_ophalen()

if __name__ == "__main__":
    main()  

错误消息:

Traceback (most recent call last):
  File "/Users/buni/Desktop/Leiden/iipr/Huiswerk python/sorteerhoed_concept.py",line 11,in <module>
    main()  
  File "/Users/buni/Desktop/Leiden/iipr/Huiswerk python/sorteerhoed_concept.py",line 8,in main
    vragen_ophalen()
  File "/Users/buni/Desktop/Leiden/iipr/Huiswerk python/sorteerhoed_concept.py",line 2,in vragen_ophalen
    text_file = open("vragen.txt","r")
FileNotFoundError: [Errno 2] No such file or directory: 'vragen.txt'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)