Created
June 8, 2020 03:14
-
-
Save paiva/9093b31fcaf29bc8e9881550f750771d to your computer and use it in GitHub Desktop.
Convert Commands to Python extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| parser = argparse.ArgumentParser(description='Converts to Python file.') | |
| parser.add_argument('filename', help='an integer for the accumulator') | |
| args = parser.parse_args() | |
| if args.filename: | |
| try: | |
| with open(args.filename,'r') as f: | |
| with open('commands_python.py','w') as out: | |
| for line in f: | |
| out.write(line) | |
| print("Done.") | |
| except (FileNotFoundError, IOError): | |
| print("Wrong file or file path") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment