Im gettng this error:
f.write("n"(var13))
SyntaxWarning: ‘str’ object is not callable; perhaps you missed a comma?
For code:
if (var11 == "register/"): usernamer=input("Username : ") var12 = usernamer f= open("Username.txt","a+") for i in range(1): f.write("n"(var12)) f.close()
Advertisement
Answer
The concatenation of strings works differently.
f.write(f"{var12}n")
if you use Python 3.6+ or
f.write(var12 + "n")
for earlier versions.
You can also do as follows:
if (var11 == "register/"): username = input("Username : ") with open("Username.txt","a+") as f: f.write(f"{usernamer}n")
which makes your code more concise and pythonic.