Module 2 python_

1.sys module

Import SYS
 # acquires a count value of the application 
A = [11,22,33 ] 
B = A
 Print (sys.getrefcount (A)) 

# Python supported by default by the number of recursive 
V1 = sys.getrecursionlimit ()
 Print (V1) 

# Input output (two lines will not change) 
sys.stdout.write ( " Hello " ) 
sys.stdout.write ( " ah " )

! ! ! ! print supplement

# \ N-newline 
# \ T tab 
# \ R & lt back to the beginning of the current line 
Print ( ' 123 \ R & lt ' , End = '' ) # finished printing 123, the cursor is returned to the starting position, and wrote the following 456 
Print ( ' 456 ' , End = '' )

! ! ! ! Application (percentage growth in value of the progress bar)

Import   Time
 # applications: in cmd run 
for I in Range (1,101 ): 
    MSG = " % S %% \ R & lt " % I
     Print (MSG, End = '' ) 
    the time.sleep ( 0.05)

2.os module

Import OS 

# obtain the file size (bytes) 
FILE_SIZE the os.stat = ( ' 123.gif ' ) .st_size
 Print (FILE_SIZE)

 

Guess you like

Origin www.cnblogs.com/wangdianchao/p/11568606.html