Install different version of Python in linux

This is how I install python 2.7.13 without erasing the current version of python that exists inside the OS. It is an alternative install. $ wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz $ tar xvf Python-2.7.13.tar.xz $ cd Python-2.7.13 $ ./configure $ make $ sudo make altinstall

Create simple arg parse in python

argparse is a module to make user-friendly command-line interfaces. It’s probably the one of the most frequently used module when I create a script in python that needs to parse some arguments. Check this out. $ vim test.py #!/usr/bin/python import argparse def init_args(): parser = argparse. ArgumentParser(description=”This is the description”) parser.add_argument(“–arg1”, required=True, type=str, help=”This is … Read more