Several times here on SO I've seen people using rt
and wt
modes for reading and writing files.
For example:
with open('input.txt', 'rt') as input_file:
with open('output.txt', 'wt') as output_file:
...
I don't see the modes documented, but since open()
doesn't throw an error - looks like it's pretty much legal to use.
What is it for and is there any difference between using wt
vs w
and rt
vs r
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…