Strip () function to delete characters_str = ' www.baidu.com '1._str.strip (RM) Delete start and end, RM sequence_str.lstrip (RM) Delete Only the beginning, RM sequence_str.rstrip (RM) Only delete end, RM sequence2. When RM is empty, the default is
#继承实现#父亲会书法, the older son and younger son can calligraphy.#父亲一般能吃, the older son eats more than the youngest boy eats lessClass Father:def write (self):print ' I can write 'Class Oldbrother (father): #class A (B) subclass a inherits the parent
2017-06-24 14:34:391, integers and long integers2. Floating point number3, plural, shape such as 1+4j, etc.4, string single quotation marks can be, there are three quotation marks, the function of three quotation marks to achieve the operation of
#abs (x) Parameter: X--Numeric expression return value: Numeric effect: Returns the absolute value of the corresponding number of X#列:# Print (ABS (-2))# All (iterable) parameter: iterable--Ganso or list return value: Boolean effect: Returns True if
When the file reads the content, it is possible to find open a file, and then read to the list or dict can only read once, and then define a variable to be assigned to the contents of the file will be removed null value.With open ('./goods.txt ', '
Reference source (actually I copied a little from the above):Python's Socket Programming tutorial http://www.oschina.net/question/12_76126Python Threading Guide Http://www.open-open.com/lib/view/open1345476194313.htmlPython socket document
In Python, there are usually several ways to represent the time:
Timestamp: Represents the offset that is calculated in seconds from 00:00:00 on January 1, 1970.
Format time: Struct_time tuple total of 9 elements total nine elements:
#-*-coding:utf-8-*-#Classic class or Old test classclassA:Passa=A ()#New ClassclassB (object):Passb=B ()#Python2 not supported#print (a.__class__)Print(A.__class__)Print(Type (A))Print(Type (a))#Python2#__main__.
5. SYS moduleSYS.ARGV command line argument list, the first element is the program itself path Sys.exit (n) exits the program, exit normally (0) sys.version Gets the version information of the Python interpreter Sys.maxint
Understanding class Properties and Instance properties:Variables defined directly within a class are called Class properties, class properties are public, each class instantiation automatically owns the properties of the class, and the initial
Object- oriented advanced Syntax section
The method of decorating is changed into a static method by @staticmethod Adorner, what is static method? In fact, it is not difficult to understand, the ordinary method can be called directly after
The final review compared busy time to write Scrapy framework use, today describes how to use Python to generate word cloud, although there are many word cloud generation tools on the Web, but their own python to write is not a more fulfilling sense.
1. Map, filter, reduce
1) Map (func, Input_list)
Apply the function to each element on the input list, such as:
Input_list = [1, 2, 3, 4, 5]
def pow_elem (x):"""To do a exponentiation on X:p Aram x:: return:"""return x * x
def multi_x_y (x,
List parsing, primarily for dynamically creating lists
This article focuses on the use of the combination of lambda, map (), and filter () with the list parsing statements
The basic syntax for list parsing is: [Expr for Iter_var in iterable]
At the
Function-Type programming
1. Simplify the code,
2, easy to call, easy to modify
3. Call parameters, shape parameters, and positional parameters. Key parameters, position parameters can only be sent after the key parameters
4. Default
Integrated python dual version details, integrated python details
I am preparing to learn Python recently. Due to the differences in versions, I don't know which one to learn. Now many things are based on python2, but python2 may be stopped around 2
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