I am new to Python and please excuse if my question sounds dumb. I have a function which reads a text file and records the first line and passes the same to another function. But I am not able to figure out a way to store the value to a global variable which can be reused again.
Sample of text file. Holds only one line: 1234567
Script to read file:
def main():
input = file(infile, 'r')
lines = input.readlines()
input.close()
i = 0
for line in lines:
i += 1
id = int(line)
WorkOnIDThread(id)
main()
So basically I want help with storing the id as a global variable which I could reuse through out the script.
Any help on this would be really helpful.