_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › Python-Tip1
|
|
[edit]
1 working directory 覲蟆 #import os print os.getcwd() # working directory 願鍵 os.chdir('d:\pydata') [edit]
2 覲 一危壱 願鍵 #>>> a = 'dynamic' >>> x = type(a) >>> x <type 'str'> >>> x.__name__ 'str' >>> 觜蟲 れ螻 螳 蟆 譬 ..
>>> isinstance('aaa', str) True >>> isinstance(123, int) True [edit]
3 ろ # ろ
>>> a = 1 >>> a = eval('a+1') >>> a 2 statment
>>> exec 'a = a + 1' >>> a 3 ろ 螻朱 貉危殊 覦 . 蠏碁 貉危 蟆朱 ろ . expression企 statment 覈 貉危狩伎 .
>>> a = 1 >>> compiled_code = compile('a + 1', '<string>', 'eval') >>> a = 1 >>> for i in range(5): ... a = eval(compiled_code) ... >>> a 6compile() 3覯讌 語..
鏤
|
企 覩(臂)手 蠍螳 覲伎譯朱 蠏碁襦 (臂) 伎襦 襴れ 覯企. 螻燕蠍郁 襴 苦 豢曙 襷譯朱 蟆 蠍(歎) 矩企. (<れ 8> 蟾一覿) |