Python Forum

Full Version: converting .py to .asc
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
Why do you want to convert the .py file into a .asc file?
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.
(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.
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.