How to convert a text file into a python script(.py) file?

McNeel Forum has given so many txt file but i can’t transfer it into a python script file

If you attach a short video showing that it will be great.

A python script file is just a text file with a .py extension.