-
Open a file
1
f = open( 'path/filename', 'r(read)/w(write)/a(append)')
-
To make sure we close the file after operation:
1
with open('filename') as f
Import Module and Function
-
With Notation (Modules)
1
2import A
import A as B -
Without Notation (Functions)
1
2from A import B
from A import B as C -
Submodules
1
2import A.B
A.B.C(arg)
近期评论