由于某些原因,尽管在主目录和同一目录中有文件,我仍然收到没有这样的文件错误。任何帮助表示赞赏。没有这样的文件或目录?
import time
def firstQues():
print('"TT(Announcing): HONING IN FROM SU CASA CUIDAD, (Their hometown)"')
time.sleep(3)
print('"VEN EL UN.....(Comes the one.....)"')
time.sleep(2)
print('"EL SOLO......(The ONLY.....)"')
time.sleep(3)
print('"Campeón NOVATO (NEWBIE CHAMP)"')
print()
text_file = open("Questions1.txt", "r")
wholefile = text_file.readline()
for wholefile in open("Questions1.txt"):
print(wholefile)
return wholefile
return text_file
def main():
firstQues()
text_file = open("Questions1.txt", "r")
main()
如果不先关闭它,则无法打开同一个文件三次;有两个返回语句也没有意义,只有第一个返回语句会起作用。 –
请检查“Questions1.txt”和上面的python脚本是否在同一个文件夹中 –
它们位于同一个文件夹中。 –