由於某些原因,儘管在主目錄和同一目錄中有文件,我仍然收到沒有這樣的文件錯誤。任何幫助表示讚賞。沒有這樣的文件或目錄?
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腳本是否在同一個文件夾中 –
它們位於同一個文件夾中。 –