with open('file.txt','r') as f:
r = f.read()
with open('file.dat','w') as f:
f.write(r)
I recommend using your resources like google before asking because I bet there are plenty of other good answers out there. You did not specify if you wished to convert the extension or translate the content. If you wish to translate the content find a lib that can do it. ;)
发布评论
评论(1)
可以这样做:
我建议在询问之前使用您的资源,因为我敢打赌,还有很多其他好的答案。
您没有指定是否希望转换扩展名或翻译内容。如果您想翻译内容,可以找到可以做到的lib。 )
That can be done this way:
I recommend using your resources like google before asking because I bet there are plenty of other good answers out there.
You did not specify if you wished to convert the extension or translate the content. If you wish to translate the content find a lib that can do it. ;)