Answer the question
In order to leave comments, you need to log in
How to create a file with Cyrillic in the file name in Windows?
There is an f.txt (utf-8) file with the following content:
один
два
три
with open('f.txt') as file:
lines = file.read().splitlines()
for line in lines:
print(line)
with open(line,'w') as file:
file.write('')
Answer the question
In order to leave comments, you need to log in
Maybe that will work?
with open('f.txt') as file:
lines = file.read().splitlines()
for line in lines:
print(line)
with open(line.encode('utf-8'), 'w') as file:
file.write('')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question