The modules learned:
Import OS
Import Sys
Import Getpass
Os.system ("Df-h")
Cmd_res = Os.system ("Df-h")
Print (Cmd_res) is 0 because the result is 0, if you want to see the result, use the following notation:
Cmd_res = Os.popen ("Df-h"). Read ()
Os.mkdir ("directory") Create a directory
Print (Sys.path)
View the path to the Python import module
General/usr/lib/python2.7/site-packages
Can import module, import module, without suffix py
If Else usage
user = Jack
passwd = 123456
Username = input ("Username:")
Password = input ("Password:")
If user = = Username:
Print ("username is correct.")
if passwd = = password:
Print ("Welcome log in.")
Else
Print ("Password is invailid.")
Optimization:
user = Jack
passwd = 123456
Username = input ("Username:")
Password = input ("Password:")
If user = = Username and passwd = = password:
Print ("Welcome login.")
Else
Print ("Username or password is invailid.")
Guess Age:
Age = 22
guess_num = Int (input ("Guess your Number"))
If Guess_num = Age:
Print ("Configratulations,you got It")
Elif Guess_num > Age:
Print ("Thins smaller")
Else
Print ("Think bigger")
Python Learning record-2016-11-28