[英]How can I join two words in python?
user = input('Create a Username: ')
passw = input('Create a Password: ')
f = open("users.txt", "a")
combine = "|".join("\n" + user + passw)
f.write(combine)
f.close()
I created a variable where I can combine both of the username and password and write It in the users.txt file.but when I try to combine "admin" and "99" It goes like this: a|d|m|i|n|9|9|
我创建了一个变量,我可以在其中组合用户名和密码并将其写入 users.txt 文件。但是当我尝试组合“admin”和“99”时,它是这样的:
a|d|m|i|n|9|9|
. .
Do simple old concatenation:做简单的旧连接:
user = input('Create a Username: ')
passw = input('Create a Password: ')
f = open("users.txt", "a")
combine = user + "|" + passw
f.write(combine)
f.close()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.