Python Forum

Full Version: variables from a text file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello everyone,
can you please give me the procedure to retrieve the variables from a text file?

exemple :
pin = "all from the first line from /home/me/myvariables.txt"
email = "all from the second line from /home/me/myvariables.txt"

Thank you.
thank you,

in this example I can read the second line from my file :

m = open('variables.txt','r')
mail = m.readlines()[1].rstrip()
print("My email : ", mail)
Big Grin