Argument Printing

#!/usr/bin/python
import sys
print len(sys.argv)
print sys.argv
print sys.argv[1]
name = sys.argv[1]
age =  sys.argv[2]
print "My name is ",name, "and age is",age



Output:
[root@mysql Scripts]# python if.py davinder 35
3
['if.py', 'davinder', '35']
davinder
My name is  davinder and age is 35

Comments

Popular posts from this blog

How to delete SEA in VIOS

More VIOS commands

Webmin configuration for LDAP