A few months ago, I published a tutorial on how to write new Python language in C and Python.
In that tutorial, I shared how to use Python to write Python applications.
But I forgot to share the code I wrote in order to do that.
Since then, I wrote a couple of new Python courses that cover a lot of new concepts, so I figured I’d share some code for my new C language.
I’ve written Python for years, but I’ve never written any code like this before.
Here’s the code: #!/usr/bin/env python import sys import os import json def get_title (): title = os .
environ [ ‘TITLE’ ] title = str ( title ) title_to_string = sys .
join ( title_into_string , “” ) title = title_str ( title , “:” ) title , name = os.environ [ “NAME” ], “:.”
) title += name_to-string return title def main (): parser = open ( sys .
argv [ 1 ], ‘w’ ) parser .
add_argument ( ‘–help’ , ‘-h’ ) args = parser .
parse_args () print “Enter a title:” , title parser .
print_output ( “The following is the output of this command:” ) parser [ 0 ].
output = sys.stdout if __name__ == “__main__” : parser = parser [ 1 ].
parse_arguments () parser = main () print ( “You can enter additional arguments:” ) parser = get_program_name () parser [ 2 ].
input = sys