生成列表 print [x+5 for x in range(0,5)] [5, 6, 7, 8, 9] print [x*x for x in range(0,5)] [0, 1, 4, 9, 16] print [(x-1)*(x) for x in range(2,101,2)] 判斷參數 >>> print isinstance(456, str); False >>> print isinstance("555", str); True
沒有留言:
張貼留言