Q:

How do i store data collected by "input" onto a text file in python

I am pretty new to python and i was just wondering if there is a way in which i could store data taken from the the function input for example:
    a = input("Question")
    b = input("Another Question")
    c = input("Another question")
    list = [a, b, c]

How can i store the list onto a text file?
Thank you

A:

You can write each variable:
# Open a file
fo = open("filename.txt", "w")
fo.write(a);
fo.write(b);
fo.write(c);

# Close opend file
fo.close()

Or you can use a loop to write the list
for item in list:
  fo.write("%s\n" % item)

