arguments Printing

#!/usr/bin/python
import sys
print len(sys.argv)
print sys.argv
print sys.argv[1]

Output:

[root@mysql Scripts]# python if.py 3 3
3
['if.py', '3', '3']
3
[root@mysql Scripts]# python if.py 5 3
3
['if.py', '5', '3']
5
[root@mysql Scripts]# python if.py davinder singh
3
['if.py', 'davinder', 'singh']
davinder


Comments

Popular posts from this blog

How to delete SEA in VIOS

More VIOS commands

Webmin configuration for LDAP