If syntax: Based on PYTHON3 syntaxIf aPrint ("yes") note that the indentation of the statement needs to be consistent, otherwise it will report a syntax error.Elif a==b:Print ("A=b")ElsePrint ("No")The comment character:# represents a single-line
1 ImportLogging2 3 4 #Simple Print Log Example5Logging.basicconfig (level=logging. DEBUG)#set the log level, WARN6Logging.warning ('Watch out!')#Would print a message to the console7Logging.info ('I told')#Would not print anything8 9 Ten #Print the
Import Urllib.requestFrom BS4 import BeautifulSoupdef get_link (page): # Looking for a linked href LinkData = [] For page in Page.find_all (' TD '): Links = page.select ("a") For each in Links: # if STR (each.get ('
The function of tuple is introduced in 1. The two methods of tuple 1. Built-in methods for tuples
Add two tuples格式:x.__add__(y)等同于x+y例如:tu1 = (1,2,3,) print(tu1.__add__((2,3,4,))) >>> (1, 2, 3, 2, 3, 4)返回值:tuple#只能是两个元组相加,生成一个新元组
Determine
Import SYSSys.pathThe system environment is a list that allows you to add the libraries you need, such as MySQL libraries, hive libraries, and so on. There are three ways to add, all validated by: 1 temporarily added, in a shell windowImport SYSSys.
One, create a listJust enclose the comma-delimited data items in square brackets.1 list1=['physics','chemistry', 1997,2000] 2 list2=[1,2,3,4,5,6,7][Note]: 1. Data items in the list do not need to have the same data type2. The index of the list
1. Blockade user-agent hack:User-agent is the browser's identity, and the site is determined by User-agent to determine the browser type. There are many sites will refuse to meet a certain standard User-agent request page, if the site will
Excerpt: Https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/ 0014318435599930270c0381a3b44db991cd6d858064ac0000#0This article is completely used for personal review study, invasion and deletion;Because a function is
First, the definitionAn OS module is an interface that interacts with the operating systemSecond, examples1 ImportOS2 #get a list of files in the current directory3 Print(Os.listdir ('.'))4 5 #get the file size6 Print(Os.stat ('m1.py'). St_size)7 8 #
Timestamp (timestamp): Typically, a timestamp represents an offset that is calculated in seconds, starting January 1, 1970 00:00:00. We run "type (Time.time ())" and return the float type.
Formatted time string (format string)
Structured
1 , Python language introductionFounder of Python: Guido Van Rossum2 , what kind of language is Python?2.1 Programming languages are categorized mainly from the following perspectives: compiled, static, dynamic, strongly-typed, and weakly
Requirements: Real Home view function, when users visit our blog home page, he will see our published list of blog posts, like Demo project show this. T https://docs.djangoproject.com/en/1.10/howto/ static-files/
Writing a blog view
I've seen Python's language before, and the syntax is simple. Because the time is too long, it seems two years ago (just want to know what Python is to see), do not remember anything, just remember that it is not C and Java language
String de-weight is a common requirement in Python string operations, and recently encountered in the work, so the following this article mainly introduces the python on the implementation of the string to re-operation of the relevant information,
Python2 basics,
3. python functions and modules
Python Function Definition:
Define a function with the def keyword;
The parameters are enclosed in parentheses;
A return statement is required;
Keyword parameter:
That is, the parameter
Python module structure and layout Operation Method Instance analysis and python instance analysis
This article describes the Python module structure and layout operations. We will share this with you for your reference. The details are as follows:
#
Python Data Structure linked list instances and python instances
In a program, you often need to manage and enable a sequence group (usually of the same type) data elements as a whole. You need to create these element groups and the sequence
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