What I Want:
- write lines to file
- simply code
It's ok if code don't need argv or some others
Here is my code:
from sys import argv script, file_name = argv target = open(file_name, 'w') while True: line = raw_input() target.write(line) target.write("\n") if line.strip() == '': break
I found two question about it, but I'm a new learner with Python and I don't know how to combine the logic from the answers in these related questions.
write multiple lines in a file
Raw input across multiple lines
Hope I express clearly.Thanks.