If I want to read the text file a and save the resulting result as a text file b, can I use the open name twice in one code?
python
You changed the question.
Of course, you have to use it once for reading and twice for writing.
r = open('', 'r')
line = r.readline(...)
...
...
w = open('', 'w')
w.write(line)
The questioner's request is the same as giving a lecture on file with Python.
I'm thinking of recommending you a book, but there's a good document online, so it's a link.
Please learn the document of the link above and write down what you are curious about.
© 2024 OneMinuteCode. All rights reserved.