Python Forum
converting .py to .asc - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: converting .py to .asc (/thread-28215.html)



converting .py to .asc - ana - Jul-09-2020

Hello
i have a .py file i want to open it using open() and convert it to .asc file . Am completely new to python. Any help will be appreciated.


RE: converting .py to .asc - Gribouillis - Jul-09-2020

Why do you want to convert the .py file into a .asc file?


RE: converting .py to .asc - steve_shambles - Jul-10-2020

The file already is ASCII, just rename
filename.py to filename.txt

To display the text file using the systems default text viewer:

import webbrowser
webbrowser.open('filename.txt')
(Jul-09-2020, 05:29 PM)ana Wrote: Hello
i have a .py file i want to open it using open() and convert it to .asc file . Am completely new to python. Any help will be appreciated.



RE: converting .py to .asc - snippsat - Jul-10-2020

(Jul-10-2020, 10:07 AM)steve_shambles Wrote: The file already is ASCII, just rename
I don't think ASCII has something to do with this.
.asc file extension are script files that have been written in the ActionScript programming language.

So @Gribouillis why question is something i also wonder about.
Can look at code in .py and try to rewrite in ActionScript,but then use Python open() i can't make sense of.


RE: converting .py to .asc - steve_shambles - Jul-10-2020

Oh dear looks like I misunderstood, sorry.

(Jul-10-2020, 12:28 PM)snippsat Wrote:
(Jul-10-2020, 10:07 AM)steve_shambles Wrote: The file already is ASCII, just rename
I don't think ASCII has something to do with this.
.asc file extension are script files that have been written in the ActionScript programming language.

So @Gribouillis why question is something i also wonder about.
Can look at code in .py and try to rewrite in ActionScript,but then use Python open() i can't make sense of.