Common modules for PythonPickle modules and JSON modulesPickle and JSON are the two modules used for serialization Serialization: The process of turning an object (variable) from memory into a storage or transfer is called serialization .The role
File operationsProcedure for file operation
Open the file, get the file handle and assign a value to a variable
Manipulating a file with a handle
Close File
1.open () Open File1 f = open ("./name.txt",'r')2 names = F.read
(1) Pythonhas a large number of compositeDatatype,used to group other values together. UsemostGuangof theis aList,can beWriteintosquare bracketsbetweenof thecomma Delimitedvalue(item iterms)of theList. Listinmay beincludedifferenttypeof
Inheritance: Type and subtype relationships between classesCode reuse: The Schoolmember class is referred to as the base class or superclass, while the teacher and student classes are referred to as export classes or
A tuple is an ordered series of tuples and lists that are similar, but tuples are immutable objects that cannot modify, add, or delete elements in tuples, but can access elements in tuplesDefinition of tuples:Tuples with comma-delimited elements in
1, the preferred Tkinter, TK itself is for the rapid GUI development, and after years of development, has been very mature, and Tkiner is a python built in the de facto standard GUI library.2, in this is not the desktop for the king of the era. Buy
Python dictionary (Dictionary)
Dict is disordered.
Key must be the only one not to change
a={'key1':'value1','key2': ' value2 '}Search and delete of dictionariesa['Key3']='Value3'#add a new element ' Key3 ' to this dictionary: '
1. View Python-installed package version information: PIP listThe original paste, there is empty perfect. http://yangzb.iteye.com/blog/18247612.Python files are executed quickly.The header file executes the Python file quickly, if you use it python
1. Python hands-onWrite the first code, print ' Hello World 'Print ('helloWorld')2. VariablesVariables are intended to store information, are called in the program, identify data names or types.Rules for variable definitions:Variable names can only
Links: http://china.nba.com/playerindex/What you need to get the JSON data page link: Http://china.nba.com/static/data/league/playerlist.jsonData source: NBA China official websiteLibrary:Requests for parsing page text dataPandas for processing
#!/usr/bin/env /pythonimport threadingimport timeimport queueimport random# producer Def proudcer (Name,que): while true: if que.qsize () This article is from the "Operation and maintenance of AC Q Group: 223843163" blog, please be sure
All we said before was to read and write real files. In fact, we can also virtual a file in memory to read and write. The official module provided to us by Python is Io.stringio and Io.bytesio.
Io. Stringio
String IO is used to read and write
First, the system command
1, Ctrl+d quit Python IDLE
Enter the EOF character in the input method, type Ctrl+d
2. Command line options:
-D provides debug output
-O Generate optimized bytecode (. pyo file)
-S does not import the site module to find
Python list and tuple types
1. Python Create List
L = [' Adam ', 95.5, ' Lisa ', ' I ', ' Bart ', 59]print l
2. Python accesses list by index
L = [95.5,85,59]print l[0]print l[1]print l[2]print l[3]
3. Python's Reverse access list
L = [95.5,
The example in this paper describes the multi-threaded port scanning function implemented by Python. Share to everyone for your reference, as follows:
The following program gives the Python code for multithreaded scanning of a given IP
"environmental information"python34+ie+windows2008Description1, for the date control, there is no way to locate the element and then directly pass the value of Processing. You can use the Execute JavaScript processing.PS: also want to learn how to
Python job: Simulate login (first week), first week of python
Simulate login job requirements:
1. the user enters the account password for login
2. Save User information in the file
3. the user password is locked three times after being entered
While loop and break, continue statement, breakcontinue
The basic loop while: while is used to output continuous statements. It simply prints a series of characters (statements) you want ).
For example, print all numbers from 0 to 100:
1
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