Common module One--sys--os---haslib digest algorithm

Source: Internet
Author: User
Tags win32

Module load order ===>> Python interpreter ====>>> third-party module =====>>> custom module

Common Modules 1

Import SYS Print (sys.modules)           #   Sys.modules found the currently loaded module, Sys.modules is a dictionary

============
SYS module
============

SYS interfaces with Python explaining its interactions

ImportSys#SYS interfaces with Python explaining its interactionsPrint(SYS.ARGV)#Current Path#if sys.argv[1] = = ' Alex ' and sys.argv[2]== ' somebody ':#print (' Login successful! ')#Else:#print (' Login failed! ')Print(sys.version)# Version information 3.6.1 (V3.6.1:69C0DB5, Mar, 18:41:36) [MSC v.1900-bit (AMD64)]#sys.exit ()Print(Sys.path)#========= Import Order #[' E:\\pycharmprojects\\python course \\s7 day20 ', ' e:\\pycharmprojects ', ' e:\\pycharmprojects\\ Python course \\s7 Day20\\python\\lib\\site-packages\\easygui ', ' d:\\python36\\python36.zip ', ' d:\\python36\\dlls ', ' D:\ \python36\\lib ', ' d:\\python36 ', ' d:\\python36\\lib\\site-packages ', ' d:\\python36\\lib\\site-packages\\win32 ', ' D : \\python36\\lib\\site-packages\\win32\\lib ', ' D:\\python36\\lib\\site-packages\\pythonwin ']Sys.path.append ('import a path that is not in Sys.path')Print(sys.Platform)#Win32

===================
Hashlib Digest algorithm
====================

ImportHashlibmd5_obj=HASHLIB.MD5('Salt'. Encode ('Utf-8'))#string add salt processing (plus user name)md5_obj. Update('Hello'. Encode ('Utf-8'))#Update processing additivePrint(Md5_obj. Hexdigest())#Show summary after all update Abstract Algorithm application: File consistency check, login user login ----Generate summary one-way non-return = = too simple when ----salt processing------salt

==================
OS operating system module
==================

operating system (software)----down-management hardware----- provide interface applications upward ImportOS# and    Directory- related # and   path-  Related # and file  -related # and OS-related #  associated with system commands #Print(OS.GETCWD ()) # View current directory path ##print (path)# Change work path Os.chdir##print (os.pardir) #. .#print (os.curdir) # . #OS. mkdir (' dir ')#OS. makedirs (' Dirs\\dir ')  Create a folder  #OS. rmdir (' dir ')#OS. Removedirs  (' Dirs\\dir ') Delete a folder #Print (OS. Listdir (OS.GETCWD ())) # listing Information # [' 1.py ', ' re-supplemental. Py ', ' module. Py '] ##======= os.stat (path) # Get file information ==========##Print (Os.stat (R ' E:\PycharmProjects\python course \s7 day20 ')) # Get file information Os.stat_result (st_mode=16895, st_ino= 38843546786076162, st_dev=513101, St_nlink=1, St_uid=0, St_gid=0, st_size=4096, st_atime=1505201438, st_mtime= 1505201438, st_ctime=1505176488)## File_state=os.stat (R ' E:\PycharmProjects\python course \s7 day20 ')#  print (File_state.st_mode)

#print (os.sep) # \ delimiter #print ([os.linesep]) # [' \ r \ n '] line break ##print (os.name) # win NT---judgment system ## os.system (' dir ') # exec # obj=os.popen (' dir ') # eval # for I in obj:#print (i)##PrintOs.environ) #Environment Variables Environ ({' allusersprofile ': ' C:\\programdata ', ' APPDATA ': ' c:\\users\\administrator\\appdata\\roaming ', ' CommonProgramFiles ': ' C:\\Program Files\\Common Files ', ' CommonProgramFiles (X86) ': ' C:\\Program Files (x86) \\Common Files ', ' COMMONPROGRAMW6432 ': ' C:\\Program Files\\Common Files ', ' COMPUTERNAME ': ' user-20170417ed ', ' COMSPEC ': ' c:\\ Windows\\system32\\cmd.exe ', ' fp_no_host_check ': ' NO ', ' homedrive ': ' C: ', ' HomePath ': ' \\Users\\Administrator ', ' LocalAppData ': ' c:\\users\\administrator\\appdata\\local ', ' logonserver ': ' \\\\user-20170417ed ', ' NUMBER_OF_ Processors ': ' 4 ', ' OS ': ' Windows_NT ', ' PATH ': ' D:\\python36\\scripts;d:\\python36; C:\\Windows\\System32; C:\\Windows; C:\\windows\\system32\\wbem; c:\\windows\\system32\\windowspowershell\\v1.0\\;D: \\python36;d:\\python36\\lib\\site-packages\\pypiwin32_ System32 ', ' pathext ': '. COM;. EXE;. BAT;. CMD;. VBS;. VBE;. JS;. JSE;. WSF;. WSH;. MSC;. PY;. PYW ', ' processor_architecture ': ' AMD64 ', ' processor_identifier ': ' Intel64 Family 6 Model stepping 9, GenuiNeintel ', ' processor_level ': ' 6 ', ' processor_revision ': ' 3a09 ', ' PROGRAMDATA ': ' C:\\programdata ', ' programfiles ': ' \ C ' \program Files ', ' ProgramFiles (X86) ': ' C:\\Program Files (x86) ', ' PROGRAMW6432 ': ' C:\\Program Files ', ' psmodulepath ': ' C : \\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\ ', ' Public ': ' C:\\users\\public ', ' pycharm_hosted ': ' 1 ', ' Pythonioencoding ': ' UTF-8 ', ' PYTHONPATH ': ' E:\\pycharmprojects;python/lib/site-packages/easygui ', ' Pythonunbuffered ': ' 1 ', ' sessionname ': ' Console ', ' systemdrive ': ' C: ', ' SYSTEMROOT ': ' C:\\Windows ', ' TEMP ': ' C:\\users\ \admini~1\\appdata\\local\\temp ', ' TMP ': ' c:\\users\\admini~1\\appdata\\local\\temp ', ' userdomain ': ' User-20170417ed ', ' USERNAME ': ' Administrator ', ' userprofile ': ' C:\\users\\administrator ', ' vbox_msi_install_path ': ' E:\\virtualbox\\ ', ' windir ': ' C:\\Windows ', ' windows_tracing_flags ': ' 3 ', ' windows_tracing_logfile ': ' C:\\BVTBin\\ Tests\\installpackage\\csilogfile.log ', ' _dfx_install_unsigned_driver ': ' 1 '})##Path#print (os.path.abspath(' 1.py ')) # Gets the absolute path C:\Users\Administrator\Desktop\1.py#print (OS. Path.split(R ' C:\Users\Administrator\Desktop\1.py ')) # (' C:\\users\\administrator\\desktop ', ' 1.py ')#=====os.path.join () path stitching ==============#Print (Os.path.join (path1,path2)) automatically adds

Common module One--sys--os---haslib digest algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.