########## #三元运算 ##########Format: result = value 1 if condition else value 2 #如果条件成立, assign value 1 to the result variable, otherwise assign value 2 to the result variable########## #基本数据类型补充 ############set:Set set, which is an unordered and
Decorative DeviceBecause a function is also an object, and a function object can be assigned to a variable, the function can also be called through a variable.def Now (): ... Print ('2015-3-25') ... >>> f = now >>> f ()2015-3-25a Function
Simplify, know IP to scan IPImportSocket fromSocketImport*a=input ('Please enter the domain name:')Try: IP=gethostbyname (a)Print('[+]'+IP)Print('The Open ports are:') defPostscanner (host,port):Try: S=socket (Af_inet,sock_stream) S.connect
Installation of Python
The first Python program
Python's installation Python website
Login to the Python official website, choose Download, there will be two options, the latest Python 3.6.3 and Python 2.7.14, the two are
Today, in http://www.pythontip.com, I encountered a sort of problem: a list of both strings, and numbers, how to sort.List = [1,2,5,4,'d','s','e', 45 ]list.sort ()If you call the sort () function directly, you will be quotedTypeError
ProcessThe execution of a file and the process of running it becomes a process.Execute multiple programs, load program files into memory, and separate the memory space of multiple programs-space reuse. Experience IO Wait, cut CPU to other programs,
Here is a note of some of the knowledge about class in Python. What is not understood without explanation means that the explanation is not understood. Class knowledge in Python the attribute references and instances of classesclassMyClass ():" "A
Because of energetic, another blog to press Yajing! Tuple (tuple) usage is the same as list, but tuples cannot delete modifications , which is the most critical feature of tuples1. Defining tuplesArr= ("123","456","789" )2. Get the first elementArr=
Concurrent.futures Module
Processes in the process pool are fixed, and if there is a task at the end of the pool, the waiting task comes in and is processed by the idle process.
Import method Three bursts: The From Header module import is as
CSV file write Chinese garbled problem and read-write error
In python2.7, the following error occurred after running the program.1 Traceback (most recent):213File"c:/users/administrator/desktop/python_code/untitled0.py", line 57,inch4File=open (
1.parse_known_args () and Parse_args () functionsThe function is a command-line parsing function that requires an import argparse ( a parser for command-line options, parameters, and subcommands ).The following is excerpted from the Python standard
A Python operating network, which is to open a Web site, or request an HTTP interface, using the Urllib module.Urllib module is a standard module, directly import Urllib can, in Python3 inside only urllib module, in Python2 There are urllib module
1. What is a constant:Constants in the program are constant quantitiesBut all the variables in Python can be changed. Note: In order to prevent errors from being differentiated, the constants in Python are named with uppercaseFor
1.(1) the. Sorted () method returns a new list (the default ascending order).List.sort ()(2). Another difference: the List.sort () method is defined only in the list, and the sorted () method is valid for all iteration sequences.2.key
First, exception handlingIn the process of running the program, you will always encounter a variety of errors. Program An error stopped running, then we can not let the program stop running it, this time we need to catch the exception, by catching
Python provides a convenient way to complete the removal of elements within a specified range, which is a slice (Slice).The following are examples of slices:In [1]: L = ['Michael','Sarah','Tracy','Bob','Jack']in [2]: lout[2]:
function as return valueHigher-order functions can also return a function as a result value, in addition to the ability to accept functions as parameters.Let's implement the summation of a mutable parameter. In general, the function of summing is
In order for the task to be concurrent we need to open the processTwo ways to open a processThe first is based on function implementationThe second is based on class implementationThe number of open processes is not infinite, so we need to introduce
Python3 selenium, python3selenium
In fact, this is equivalent to simulating a person's Click Event to continuously access the browser. If you have played the glory of the king, there will be a bug in the January 2016 version.
After downloading a key
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