Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 12
    Please be more clear. Do you just want to encode the file so that you can decode it later (by the command line, say)? Or do you want to make a file that you can still run by python myfile.py but have myfile.py be encoded? Commented Jul 27, 2010 at 13:32
  • 11
    What are you trying to hide? There is no effective way to obfuscate python such that it can not be trivially converted back to human readable. If you have code that valuable, convert it to C, or keep it on a server. Commented Jul 27, 2010 at 14:15
  • 6
    semiuseless: I suspect 30 lines of code isn't going to be hidden that well in C, either. Commented Jul 27, 2010 at 14:43
  • This is (as has been posted previously) almost completely useless, but if you really want to, you can use alternate encoding, like say ROT13. Commented Jul 27, 2010 at 15:58
  • 4
    The reality is that Python is not the right language to use if you want to obfuscate the code. This posting has some excellent discussions about this very point. Commented Aug 9, 2013 at 16:46