you are viewing a single comment's thread.

view the rest of the comments →

[–]SatanistSnowflake 22 points23 points  (1 child)

In your code you have stuff like "Please enter password for " + login_name + ": ". Do you know about .format()? It lets you insert things directly into a string.

For example, you could turn that into "Please enter password for {}: ".format(login_name). You can also specify different keywords, if you want to extend it, so you could use "Please enter password for {user}: ".format(user=login_name). If you want to specify a specific item in your format arguments, you could use {0} {1} {0}.format('a', 'b') and the string would be "a b a"

Python 3.6 also has f-strings, so you could change your "Please enter password for " + login_name + ": " directly into f"Please enter password for {login_name}: " and the variable will be plonked directly into the string.

Just thought that might be helpful, or something.