Python Self-Study notes – Basic Overview
Print () function
The usual print function, similar to the C language's printf function. And can be used in conjunction with the string format operator (%) to implement the string substitution function
>>>
Recently in the internship, boss to decorate a small Python task, learning process found copy () and deepcopy () this is a bit too good for the base friend, make the blogger is a bit silly to distinguish ah, but in the spirit of a probe in the end,
about Django Request extension "Get user device Information"settings.pyInstalled_apps = [ ... ' App01 ', # Register App]staticfiles_dirs = (Os.path.join (base_dir, "statics"), # Now add the configuration, here is the tuple, note the comma
User Login three times error, popup hint Y or N1 #User Login (three input opportunities) and each error will show the number of remaining errors (hint: Format the string)2 3 #i = 34 #username = ' Allan '5 #password = ' 12345 '6 #While i > 0:7 #name =
One, is and = =1.1== comparison, compare = = = value on both sides of the data1A ='Alex'2b ='Alex'3 Print(A = = b)#True4 5n = 106N1 = 107 Print(n = = n1)#True8 9Li1 = [A]TenLi2 = [A] One Print(Li1 = = Li2)#True 1.1.1id () or Fetch data storage
A. Is and = = difference:= = Compare #比较两边的值is comparison #比较的是内存地址ID () is a built-in function of Python, by ID () we can find the value of a variable table in memory address(Numbers and strings are true only)#数字小数据池: -5~2561. If there are special
Djangoform Basic Knowledge Summary1. What is a form? A component used to verify the legitimacy of user request data 2, the implementation steps of the Django form: A. Create a template that validates user requests from the Django Import Forms Class
Use of If,elseIn a Python program, the IF statement implements:score = 95if score >= 90: print(‘Outstanding‘)?If the condition is followed by a conditional judgment statement, if the result of the judgment statement is true, execute if the
What the f**k!! The biggest culprit with this knowledge is that I'm single???Python Basics (iv):Object-oriented three features: encapsulation, inheritance, polymorphismClass:Objects are the core of object-oriented programming, and in the process of
A = ' Pythyon ' i = 2for element in a: if element = = ' Y ': pass i = 3 else: print (ELEMENT+STR (i))Results:P2t3h3o3n3 A = ' Pythyon ' i = 2for element in a: if element = = ' Y ': continue i = 3 else:
1. Dictionary Dict
Dict with {} to indicate that the key value is unique to the data {Key:value} key
Keys: All must be hashed, except for lists, immutable data types can be used as keys in the dictionary
There is
Concurrency: The system has the ability to handle multiple tasks (actions)Parallelism: The system has the ability to simultaneously handle multiple tasks (actions)Synchronization: When the process executes to an IO (waiting for external data), it
69605318Python contains the module method in subdirectories is relatively simple, the key is to be able to find the path to the module file inside the Sys.path.Here are some examples of common situations:(1) The main program and the module program
A simple introduction to the dictionary1. Dict with {} to indicate key value pair data {Key:value} uniqueness2, the key must be a hash, immutable data type can be used as a key in the dictionaryThere is no limit to the value3. Known hash (immutable)
Input1. In the Python2 version1.1 Using the Raw_input () function,See the example below: password = raw_input("请输入密码:") print (‘您刚刚输入的密码是:%s‘, % password)Operation Result: Attention:
The parentheses in raw_input () enclose a
1. Data type:int: integer str: string, generally does not hold a large number of data bool: Boolean value, used to determine only two values True False list: Lists, used to hold a large amount of data [] to indicate that it can put any data
the ORM Querybased on objectforward query vs. reverse query queries in the form of objects# Forward Query Ret1=models. Book.objects.first () print ( ret1.title) print ( ret1.price) print ( ret1.publisher) print ( Ret1.publisher.name)
Git:https://github.com/linyi0604/computer-vision1 #Coding:utf82 3 ImportCv24 ImportNumPy as NP5 6 #Create a black blank image of 200*2007img = Np.zeros ((dtype=),np.uint8)8 #Place a 100*100 white square in the center of the image9img[50:150, 50:150]
Other common methods of strings:Ord (char) # returns the code value corresponding to the char character, which can be a Chinese characterChr (x) # Enter a Unicode code to return the corresponding charactereval (str) # returns the contents of Str in
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