def false_to_true():
name = input("Input name: ")
file=open("users.txt","r")
lines = file.readlines()
file.close()
for line in lines:
username, lel, type = line.split("/")
#This while dont work, work only for last line in text. How to fix
while name == username:
name = input("input name again: ")
type = "True"
with open("users.txt", "w") as users:
users.write("/".join([username, lel, type]))
false_to_true()
我没有为我输入的用户名更改单词False为True。 我在文件用户中有这个文本:
#Marko123/male/False
#Mimi007/female/False
#John33/male/False
#Lisa12/female/False
#Inna23/female/False
#Alisa27/female/False
当我输入用户名Lisa12时,我不会得到这个文字:
#Marko123/male/False
#Mimi007/female/False
#John33/male/False
#Lisa12/female/True -here-
#Inna23/female/False
#Alisa27/female/False