Here are four of:
1. Implement the progress bar
2. Depth copy
3. Ternary operation
4.format Format Transfer Dictionary
1 #progress bar2 Import Time3 forIinchRange (10):4Time.sleep (1)5 Print('*', end="', flush=True)6 #The end default parameter is ' \ n ', so no value is passed by default;7 #the meaning of flush here is to cycle through the print once, the default parameter is ' False ', if it is specified as true, here will be 10 seconds after printing together 10 *8 #now the above code prints a result of one per second *9 Ten #dark Copy, deep copy is the memory address is different, shallow copy is the memory address of the variable is the same OneA=b=c='haha' A Print(ID (a), id (b), ID (c))#memory addresses are the same -C='Xixi' - Print(ID (a), id (b), ID (c))#C memory address is not the same thee=f=g=['haha', 123] - Print(ID (e), id (f), ID (g))#memory addresses are the same -G.append ('Xixi') - Print(ID (e), id (f), ID (g))#memory addresses are still the same + - #the above direct a=b=c is a shallow copy, the deep copy needs to use copy module + ImportCopy AA=b=c='haha' at Print(ID (a), id (b), ID (c))#memory addresses are the same -D=Copy.deepcopy (a) - Print(ID (a), id (b), ID (c))#C memory address is not the same, this is the deep copy - - #Ternary Operations -A=8 inb=2 -C=bifB>aElseA#This is the ternary operation . to Print(c) + - #format pass -through dictionary the Print('{name},{age}'. Format (age=18,name='XG')) *dic={' Age': 18,'name':'XG'} $ Print('{name},{age}'. Format_map (DIC))#Format_map This method behind a dictionary can bePanax Notoginseng #The result of the above output is the same
Python3 from zero single row _ Some fun stuff