1. 程式人生 > >python學習:函數傳參數

python學習:函數傳參數

函數傳參 參數 傳參數 bsp pri () python學習 for [1]

#!/usr/bin/python import sys def isNum(s): for i in s: if i in ‘0123456789‘: pass else: print "%s is not a number" %s sys.exit() else: print "%s is a number" %s isNum(sys.argv[1]) //函數判斷是否為數字 執行結果: python 12.py aa aa is not a number [[email protected] day02]# python 12.py 123 123 is a number [[email protected] day02]# python 12.py 123d 123d is not a number

python學習:函數傳參數