面条版
def register():
while True:
username = input('pls input your name:').strip()
with open (path.user_info_path, 'rt', encoding='utf-8') as f:
data = f.read ()
if username not in data:
passwd = input('pls input your passwd:').strip()
sec_passwd = input('pls confirm your password:').strip()
if passwd == sec_passwd:
with open (path.user_info_path, 'at', encoding='utf-8') as f:
f.write ('%s %s\n' % (username, passwd))
print('you register is successful!')
break
else:
print('pls input same password!')
continue
else:
print ('the count already exsit,pls input another username!')
continue