_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
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覯讌 語..
鏤
|
襷 螳蠑碁 蟆 殊 螳蠑碁 蟆企. (觚襭 觜貅) |