我有點難住。如何在Python中的外部文件中搜索字典
我在學習Python,我正在嘗試創建一個登錄序列。下面是相關的代碼我到目前爲止
def login():
usr = input("Please enter your name:")
with open("IDs.py", "r+") as f:
for line in f:
for i in line:
print(line) ##I know that this doesn't work at all I was experimenting with a couple concepts :P
pas = input("Please enter your password:")
問題IDs.py的文件看起來像this`
_example = dict([("j5vlK5tO", "TYhx0RJU3")])
_example = dict([("iSWGaTF", "xsR5Q0bnP")])
_example = dict([("l9uJFyiX", "1GgaTJ5H")])
我真的很小白,所以也許這是真的簡單嗎?對不起,如果是這樣!任何意見或建議表示讚賞,謝謝!
感謝您的幫助! – Kris