一.单星号 * 采用 * 可将列表或元祖中的元素直接取出,作为随机数的上下限: import random a = [1,4] print(random.randrange(*a)) 或者for循环输出: import random a = [1,4] for i in range(*a): print(i) ''' result : 1 2 3 ''' 二.双星号 ** 双星号 ** 可将字典里的"值"取出,如下例 class Proxy(object): def __init__(…
Python dictionary 字典 常用法 d = {} d.has_key(key_in) # if has the key of key_in d.keys() # keys list d.values() # values list d.get(key_in,[defualt]) # it will return 'NoneType' or [default] if with the secon…