I have a list of numbers and need to put them all into a text file on their own line. I can't figure out how to call to each item and print them. I only know how to write strings into a text file.
Would I have to count each item and use the range function somehow? There has to be a better way. I'm pretty stuck with what to start with.
f = open("numbers.txt", "r")
numlist = []
for line in f:
numlist.extend([n for n in map(float, line.split()) if n > 0])
print numlist
f.close()
g = open("output.txt", "w")
g.write(#writes each item in the list on its own line)
g.close()