from pprint import pprint pprint (vars(your_object)) 打印對象的屬性和屬性值
字符串與數字的轉化 數字變爲字符串 str() 字符串變爲數字 string.atoi(s,[,base]) //base爲進制基數 浮點數轉換 string.atof(s)
打印異常信息 try: 1/0 except Exception, e: exstr = traceback.format_exc() print exstr
time.strftime('%Y-%m-%d',time.localtime(time.time()))
a和b的內存地址同樣 a=["abc","123"] b=a print id(a),id(b)