I have this code, what I want it to do is take a user input of something like:
1
2
3
4
5
And turn it into: 1, 2, 3, 4, 5
My code doesn't seem to do it, it just returns the first word in the list, any help would be amazing.
i = raw_input("Put the list here: ")
print (i.replace("\r", ", "))
I changed the format, it will now pull the input from a text file, this seems to work as long as each line is only seperated by a single line break
i = open("input.txt", "r")
o = open("output.txt", "w")
for line in i.readlines():
o.write (line.replace("\n", ", "))
i.close()
o.close()