1. 程式人生 > >python獲取參數

python獲取參數

py

#!/usr/bin/env python 
#encoding=utf-8
import sys
def systest():
    first = sys.argv[1]
    print first
def judgeargv():
    total = len(sys.argv)
    if total != 2:
        print "參數個數不等於1 退出程序"
        sys.exit(0)
if __name__ == "__main__":
    judgeargv()
    systest()

本文出自 “磚家博客” 博客,請務必保留此出處http://wsxxsl.blog.51cto.com/9085838/1956042

python獲取參數