Reading Command Line

#! /usr/bin/env python
# This is the clearify of how to read the argyment
# from command line in python and use it in python.

import sys


def ReadCommand():
    '''
    this variable is a list and the first
    element in is is the name if python
    script and the other element in this
    list if anything that you can take it
    and used them.
    '''
    lstOfCommands = sys.argv
    return lstOfCommands


def printingName(name):
    print "[*] Hello " + name


def main():
    '''you can directly access sys.argv'''
    sysList = ReadCommand()

    for name in sysList[1:]:
        printingName(name)


if __name__ == '__main__':
    main()

2 thoughts on “Reading Command Line

  1. I’ll immediately grab your rss as I can’t to find your e-mail subscription hyperlink or
    newsletter service. Do you’ve any? Please allow me know so that I may subscribe. Thanks.

Leave a comment