简体   繁体   中英

How to load info from another FILE in python

I want to run something from another file that I created but it is repeating the first part of the code. Please comment/respond respectfully :)

from replit import clear
from time import sleep
import pickle
playername= input("Enter your username: ")
sleep(1.0)
pickle.dump(playername, open(playername, "wb"))

clear()
import gamemenu.py
gamemenu.py = open(gamemenu.py, open(gamemenu.py))

my output is

Enter your username:

enters username

Enter your username:

我不确定您的其余代码,但这看起来是错误的:

gamemenu.py = open(gamemenu.py, open(gamemenu.py))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM