各種モジュールメソッドクエリー

2034 ワード

モジュール
 python   .py         
           ,   import     

                 
     :
	easy_install
	pycharm setting  
	pip			(    )


    (         )
if __name == '__main__':
	fuinc()

osモジュール
os:        
    : window :         。
    : mac:        
os.getcwd()					      
os.listdir()				          ,            
os.path.abspath()			        ,          ,    
	os.path.abspath(__file__)	       
os.path.split()				    ,    ,            
os.path.split				     ,       ,           
os.path.basename()			      
os.path.dirname()			         
os.path.getsize()			      
os.path.exists()			        
os.path.isdir()				         
os.path.file()				         

Sysモジュール
  python         
sys.path

          
sys.platform

           (  )
sys.argv

timeモジュール
time.time()
          


time.gmtime()
              
     ,   ,  ,     ,     8  


time.localtime()
          
     ,   ,  ,     ,     
time.mktime(t)
             

time.strftime(%Y-%m-%d %H:%M:%S',lt)
               
time.strptime(2018-03-27 22:03:26','%Y-%m-%d %X')
              


time.asctime()
            


time.ctime
           


time.sleep(5)
            cpu  ,     

時間書式
  	  	  
%a	  (locale)      	
%A	        	
%b	        	
%B	        	
%c	            	
%d	        (01 - 31)	
%H	         (24   ,00 - 23)	
%I	     (12   ,01 - 12)	
%j	       (001 - 366)	
%m	  (01 - 12)	
%M	   (00 - 59)	
%p	  am  pm    	 
%S	 (01 - 61)	 
%U	       。(00 - 53           。)                 0 。	 
%w	         (0 - 6,0    )	 
%W	 %U    ,    %W            。	
%x	      	
%X	      	
%y	       (00 - 99)	
%Y	     	
%Z	     (         )	
%%	‘%'  

datetimeモジュール
     :
datetime :        
timedelta :       ,         
tzinfo :       
date:      


  :
        
datetime.datetime.now()
#datetime.datetime(2018, 3, 28, 21, 59, 7, 95015)

      
datetime.datetime()

        
time.strftime('%Y-%m-%d')