python-2.7executable-format

Saving python script in executable format


How do I save the python script that I'm working on in executable format in a specific folder? Saving manually is not allowed. The code for saving must be within the script itself. Thanks in advance.


Solution

  • with open('myexecutable', 'w') as efile:
        efile.write('all my code goes here')