如何解决“_io.TextIOWrapper”对象不可下标
我在 JSON 文件中有这种用于某种登录系统的“数据库”,但我想检查某个项目是否在列表中,因此如果您想登录,可以继续
这是我的代码:
if option == 'Login':
username = pyautogui.prompt(title="Login",text="Enter your username").lower()
with open("Cool_Database.json","r+") as DB: # open json file and gives it the variable DB
if username in DB["Name"]: # You can login by typing username but it needs to be in json file same for the password
# If username in 'database' u can enter the password that matches mask password i
password = pyautogui.password(title="Login",text="Type your password",mask='*')
else:
return main()
if password in DB["Password"]:
# If password in list u can move on..
while True: ...
TypeError: '_io.TextIOWrapper' object is not subscriptable
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。