First, prefaceThe string is an important data type in Python. A string is a piece of text that is marked in quotation marks in Python.Second, string classificationStrings are divided into 3 categories depending on the usage scenario:(1) Single-quote,
One of the most common ways to use pandas packagesimport Pandas as pd #任意的多组列表a = [1,2,3]b = [4,5,6] #字典中的key值即为csv中列名dataframe = PD. DataFrame ({ ' a_name ': A, ' B_name ': b}) #将DataFrame存储为csv, index indicates whether the row name is displayed,
OS module: interface of the operating systemSource code in lib/os.py
os.name determine the system Os.system () Run the shell command
' nt ': Windows;
' POSIX ': ' Linux/unix '.
os.chdir (path)
One, operator1. Arithmetic operation:2. Comparison operation:3. Assignment Operation:4. Logical Operation:5. Member Arithmetic:
II. Basic data types1. Digitalint (integral type)On a 32-bit machine, the number of integers is 32 bits and the
The reflection functionality in Python is provided by the following four built-in functions: Hasattr, GetAttr, SetAttr, delattr, and four functions for internal execution of objects: Check for a member, get a member, set a member, delete a
classStudent (object):#The class name is followed by student, the class name is usually the first word in uppercase, followed by (object), indicating which class the class inherits from. In general, if there is no suitable inheriting class, use the
"" "# String index with slice # string All operations will not change the original string, will only generate a new string s =" ABCDEFGHIGKLM "S1 = s[0] Print (S1) # Gu Tou disregard tail string slicing S2 = s[0:2] Print (s2) s3 = s[:] # Get all
function definition
The function code block begins with a def keyword followed by the function identifier name and parentheses ().
Any incoming parameters and arguments must be placed in the middle of the parentheses. Parentheses can be
Classes and objectsClasses and objects in Pyhon are very different from classes and objects in C + +, but they are all designed to encapsulate the properties and methods of an object, and the methods used for Pyhon classes and objects are discussed
1. Iterator protocolThe object provides a. Next () method that executes the next method either returning the next item of the program, or getting an exception program, and this iteration can only be done backwards (an inappropriate metaphor: Only
Python file reading and writing is determined by the parameters of the open () function to read and writeOpen (file, mode= ' R ', Buffering=none, Encoding=none, Errors=none, Newline=none, Closefd=true)The Open function defaults to r mode as
The main contents of this section :1. review of the pass decorator2. information about the function3. decorative Adorner with parameters4. a plurality of adorners are decorated at the same time. Functions ? . review of the pass-through
Yesterday review:file processing opens the file open (' path ', ' open mode ',' Specify the encoding method ' ) Open mode R w a r+ w+ A + b r+ open File Direct write and read re-write encoding method--utf-8
XML is a protocol that implements data exchange between different languages or programs, much like JSON, but JSON is simpler to use, but in ancient times, in the Dark Ages when JSON was not yet born, you could only choose to use XML, and so far many
Original Address https://www.cnblogs.com/nice107/p/8118876.htmlWhen we learn python, most of the contact is often those functions, for the Python function, here for everyone summed up these, if there are gaps, please leave a message!1. Common
Self can be understood asSimilar to the this pointer in C + +, the object itself means that when the method is called with an object, the object is passed as the first argument to selfThere are properties, methods in the Python class, where
NO1:Functional programming: That is, a function can be passed as a parameter or as a return valueNo2:map()The function receives two parameters, one is the function, the other is to function the Iterable map incoming function to each element of 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