Team7 Print(Queue_l.pop (0))8 Print(Queue_l.pop (0))9 Print(Queue_l.pop (0))Ten Print(Queue_l.pop (0)) One Print(Queue_l.pop (0)) A Print(Queue_l.pop (0))5, del, remove delete1 del # Simple Delete 2 hobbies.remove ('eat'# Simple Delete, and is the specified element to remove6. Len Lengthdetermine the default first length of the list hobbies=['play','eat',' Sleep ','study']print(len (hobbies))7. In contains 1 Determines if the sleep element exists with hobbies in the return true, return false
1, locals, globals1 def func (): 2 x = 13 y = 24print (Locals ()) # Prints the name in the local scope 5 Print# Prints the name in the global scope2.1 Print(123)2 "print (456)" #string3Eval"print (456)")#convert string to Python code to execute4 5 Output Results6123755W81exec("print (789)")91 num = 1+2+3Ten2 num = eval ("1+2+3")#execution will perform operation with return value One3Print(num) A4 -5 6 -1 num2 =exec("4+5+6")#executed, but no return value the2Print(num2) -3defmy
list Chr (x ) convert an integer to a character Unichr (x ) convert an integer to unicode character Ord (x convert a character to its integer value Hex (x Span class= "pun" >) convert an integer to a hexadecimal string Oct ( x ) convert an integer to an octal string Five, data arithmeticArithmetic operations (add, subtract, multiply and divide) (+,-, *,/)Comparison operationTernary operationsL = [1,2,3,4,5] for in L: If i else
maintain catalog files (i). Job
Browse, manage, and maintain directory files (ii). Job1) turn on the Linux operating system and require the root user to log in to the Gnome GUI, right click on the desktop to open the terminal2) Use the command to switch to the root user's home directory3) Determine the working directory where the current user is located4) Create a directory WG5) Create a new file in the WG directory using the absolute path method a.txt6) Enter the WG directory7) Create a new
dynamic monitoring System Status2) exit the previous step3) Turn on the top process4) Use the PS command to view the top command's PID and kill5) View process tree for process with PID 26) Open Firefox browser7) Look for a process named Firefox8) Kill the process called Firefoxdelivered jobs: system monitoring. Jobs
RPM Package management. Jobs1) Mount the disc file to the/media directory2) Enter the packages directory under the/media directory3) View all RPM packages installed on the syste
First, the Linux Foundation-Simple operation of the computer and the servers that we have developed later.Ii. development of PythonA.python Foundation-Basic-Basic data type-function-Object OrientedB. Network programmingC.web Frame-For writing websitesD. Design pattern + algorithmE. Project phaseBlog Park:Essays-everyone can seeArticle-not found by others, but can be found by URLLog-No one can find it and the URL can't be foundPython Full
(pattern,string,flags) features: nbsp Use regular match target string parameters: patter n Regular string target string Return value: NBSP;NBSp Iteration Object----Iteration content for match object Re.fullmatch (pattern,string,flags) nbsp function: match exactly one string parameter: nbs P pattern regular string NB Sp Target string return value: Match object, match to content NB Sp Re.match (pattern,string,flags)
fromMultiprocessingImportProcessdeffunc (num):Print("In func", Num,os.getpid (), Os.getppid ())if __name__=="__main__": Print("In main", Os.getpid (), Os.getppid ()) P=process (target=func,args= (1,)) P.start ()Print(P.is_alive ())#True to detect whether the process is performing a taskP.join ()#blocks wait for the child process to finish before executing the subsequent code Print(P.is_alive ())#False The child process task has endedP.terminate ()#force End Child process non-blocking P
to get results The virtual attribute cannot be copied s.score = # by S.score to modify the score print (S.score) # Modify Success S.score It looks like the property is an impersonation attribute the actual interior has been replacedProblem:L = [1, 2, 3]def f1 (LST):LST + = [4, 5, 6]F1 (L)Print (L) # [1, 2, 3, 4, 5, 6] WhyL = (1, 2, 3)def f1 (LST):LST + = (4, 5, 6) # LST = lst + (4, 5, 6)F1 (L)Print (L) # (1, 2, 3) whyPractice:1. Implement two custom list additionsClass MyList:.... Implement i
memory of the longest should be in their own way to the reality or some examples of comparison The more the vernacular the better remember what the gaudy terms know what is OK (remember Say it as much as possible. Just a corresponding instance relationship in your mind is like a variable in memory .... Off the topic, slipped away) What are arguments, arguments, and parameters?Arguments are parameters when a function is calledA pass is a process that passes a parameter to an argumentParam
numbersmsg ='I am% (name) s my age are% (age) S'%{'name':'Liu',' Age': 19}#through the dictionary of the situation splicingmsg ='value:%.3f'%1.56789#Stitching floating point numbermsg ='value:% (value). 4f'%{'value': 9.87654}#floating-point numbers are spliced in a dictionary formmsg ='value:%.2f%%'%50.7823#Print percent signPrint(msg)Two format modes"""format mode [[Fill]align][sign][#][0][width][,][.precision][type]fill] optional white space filled character align optional alignment (required
((6,6,6,6,6,8,8,8,8,8,8,))B=counter ({"Name": "Alex", "name": "Eve", "name": "Mary"})print (c) # Counter ({' H ': 6, ' F ': 6, ' G ': 4, ' d ': 3}) returned as a dictionaryprint (d) # Counter ({2:4, 3:4, 4:4, 1:1})print (e) # Counter ({8:6, 6:5})print (b) # Counter ({' name ': ' Mary '})three. Random1.random (+)#0到1之间的小数2.uniform (1.3)# more than 1 decimals less than 33.randint (1,5)# 1=4.randrange (1,10,2)# 1 to 10 odd Gu Tou regardless of tail5.choice ([1, "23°c", [4,5])# There must be an ind
, and so on, all variables, classes are marked during execution, and after execution, they are automatically reclaimed for a period of time without being called.class A:def __del__ (self):print ("666")a1=a ()a1.__del__10.__new__ Usageclass A:def __init__ (self):self.x=1print ("in init function") # Fifth Stepdef __new__ (Cls,*args,**kwargs): # The second step automates the __new__ methodprint (CLS) # Third Step print ("in new Function") # Fourth Stepreturn super (). __new__ (CLS) # Returns an obj
One, in HTML | Safe can be processed in the background in the following ways1 " " 2 from Import Mark_safe 3 Text = Mark_safe (text)Second, views.py operation1 fromDjango.shortcutsImportRender2 3 fromDjangoImportForms4 fromDjango.formsImportfields,widgets5 fromApp01ImportModels6 classLoveform (forms. Form):7Price =Fields . Integerfield ()8USER_ID =Fields . Integerfield (9 #widget=widgets. Select (choices=[(1, ' Alex '), (2, ' Xialv '), (3, ' SB '),])Ten #Database Fetch value
parameter of the formal parameter.Default parameter does not pass the value is the default value, the pass value overrides the default value.def func2 (y, X, z=): print (x, y, z) func2 (1, 2, 3000)def input_information (name, sex= ' man '): With open (' Information ', encoding= ' utf-8 ', mode= ' a ') as F1: f1.write (' { }\t{}\n '. Format (name,sex)) while True: msg = input (' Please enter the user's name, gender \q or Q exit '). Strip () if msg.upper () = = ' Q ': Br
in iterable if condition) # Filter ModePros: 1. Save codeCons: Bad troubleshootingOverall: Generally used in a list deduction structure, in other ways can also, very complex list, list derivation is not constructedBuilt-in functions1.1 Scope-relatedA =33b = 22def func (): a = 1 print (Globals (), ' \ n ', locals ()) func ()1.21 Other relatedExecution of String type code Eval,exec,compliePrint (eval (' 1*2*3*4*5*6*7*8*9 ')) Li = "" For I in Range: print (i) "" "Exec (LI)1.22 input and o
))yield "222"Gen=func () # If there is yield in the function, this function is the generator function ret=gen.__next__ () # generator is essentially an iterator that can be executed directly __next__ () print (ret)(2) The difference between yield and return.#there is yield in the program, the function is the generator function, the access generator function, the function does not execute, returns a generator.# The generator executes __next__ and executes to the next yield.# yield and return are
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.