How can I read a .txt
file in python and write those contents into a .md
file without any change in content. I have googled enough but couldn't find a proper answer . ?
Answer
If you're not changing the contents you could just change the file extension. See this SO answer for help
Change the file extension for files in a folder in Python
Edited based on comment
If you want to make a copy this is the simplest way I believe
import shutil
shutil.copyfile("testcopy.txt", "testcopy.md")
No comments:
Post a Comment