I heard that Ujson is a lot faster than the JSON module, special to try:#-*-coding:utf-8-*-ImportJSONImportUjsonImport TimedefCost_time (func):defInner (*args, * *Kwargs): Start_time=time.time () result= Func (*args, * *Kwargs) Stop_time=time.time ()
Definition of a functionFunctions are well-organized, reusable pieces of code that are used to implement a single, or associated function. Functions can improve the modularity of the application, and the reuse of the code. Python provides a number
File operation, there are ' R ', ' W ', ' A ' different operation types, where ' r ' can only read the file, Seek (), tell () function to locate the starting place of the read.' W ' clears the contents of the file and then writes the file, Seek (),
The previous article just introduced Python's multi-version environment configuration, and then I changed the Python2 python.exe to Python2.exe, Python2 Pip is not good, there has been title error ...And then the solution was simple, though slightly
One, the operation of the dictionarya={'name':'wo',' Age': 18}dict.clear ()#Delete all elements in a dictionarya.clear () dict.copy ( )#returns a shallow copy of a dictionarya.copy () dict.get (key, default=none)#returns the value of the specified
From keyword import kwlistPrint (kwlist)For I in Kwlist: Print (i)All key characters can be displayed, and developers should not re-assign other values.A = 10000B = 10000Print (ID (a))Print (ID (b))"" 57856560"" 57856560In Python, the values of
Introduction of Urlparse ModuleThe Urlparse module mainly splits the URL into 6 parts and returns the tuple. And you can make the split part a URL again. The main functions are Urljoin, Urlsplit, Urlunsplit, Urlparse and so on.Second, Urljoin
I. PracticeCode:Output:TwoString VariablesCode:Output:Three, input variablesCode:Output:Description: Python can automatically detect the type of input. If the numeric value of the integer type, enter a float or other seven or eight bad things, can
IntlongfloatcomplexbooleanList, tupleLists: list []Change and deleteName.append[] Append to the last one,Name.insert (1, "xxxxx") add xxxxx to subscript 1name.remove[' xxx '],Del Name[1],Name.pop (subscript) Delete the last one by defaultname[3]= ' 2
Python data structures are mainly: list lists,1, List(1) Basic methodsPrint("lsit List of PYTHON data Structures") A=[66.34,666,666,1,25.6]Print("list.count (x) returns the number of occurrences of x in the list:", A.count (666), A.count (66.34),
Key wordsThe keyword is a python-built, special-meaning identifier that cannot be duplicated when the custom identifier is named. The following code allows you to view Python's built-in keyword contentImport Keywordprint (keyword.kwlist)[' False ', '
Python variable,
Python variable
It is very easy to define variables in python, for example, the following code:
Name = "admin"; print (name );
The above is to define a basic variable. Here we will talk about some other things about the variable.
First week of Python learning, first week of python
I. My first program
print("Hello word!")
Therefore, python is a very concise language. Unlike c, c ++, and so on, you have to call a bunch of libraries to write a simple program. In addition,
Python input,
Python Input
The input after python3 is different from that after python2.7. The input function is input ()
Username = input ("username"); password = input ("password"); print ("username", username); print ("password", password
Common commands of Python OS and pythonos
1. OS. name --- determines the current practical platform. In Windows, 'nt 'is returned; in linux, 'posix' is returned'
2. OS. getcwd () --- get the current working directory.
3. OS. listdir ()---
4.
Shorthand Boolean Value
In python. Boolean values include true and False. True equals to true, and False equals to error. Note that uppercase and lowercase letters are strictly required in python. The first letter of true and False must be
Operations of the Python set type, and operations of the python set type
Similar to other languages, python set is a disordered, non-repeating element set. Its basic functions include link testing and deduplication. the Set object also supports
Pandas. DataFrame Learning Series 1-Definition and attributes,
Definition:
DataFrame is a two-dimensional, variable-size, component-mixing table data structure with a tagged coordinate axis (rows and columns. Calculate based on row and column labels.
Python learning 3 and python Learning
Start on the third day ~~
--- Function ---
Abs function. Only one parameter can be passed and the absolute value of the parameter is returned.
Max (), transformation functions, and so on. Check the
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