Input and output of Python (Learning note i)
Output
With Print plus a string, you can output the specified text to the screen. As the following command:print ' hello,world! '650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/92
list.append (obj) adds an object Objlist.count (obj) to the list that returns the number of times that obj appears in the list list.extend (seq) a adds the contents of the sequence SEQ to the list list.index ( obj, I=0,j=len (list)) returns the K
1 #!/user/bin/env python2 #-*-coding:utf-8-*-3 __author__='Howie'4names = ['Zhangsan','LiSi','Wangwu',['Lili','dddd'],'Zhaoliu','DAda']5 #A = names[-2:] #如果想取倒数几个数需要吧最后一个省略6A = Names[:3]#If you want to take the first start to the number of numbers
1.dict Get ValueDict.get (Key_name)2. Ternary operationRes,err=stdout.read (), Stderr.read () #三元运算Result=res If res else errPrint (Result.decode ())36:10Knowledge Review:1. Executing a thread, how do I get the results?2.eventEvent.set ()
' Shiyanlou ' # here, is left closed right open, is the angle mark is greater than or equal to 1 and less than 3, is the number, so is ' Hi ' ' Hi ' # here, equals S[0:7], because the increment of the value of 1 is the default, you can also change
Python has been in contact for some time, a mention of Python, probably most pythoner will think of reptiles, yes, today we are the topic of reptiles! As a pupil, about the crawler actually I also only slightly understand, with "done is better than
The three functions of __setitem__ __getitem__ __delitem__is to handle attributes in dictionary formDictionary form using brackets to get valuesClass Foo: def __init__ (self,name): self.name=name def __getitem__ (self, item):
Python Basics-Abstract class1 What is abstract classLike Java, Python also has the concept of abstract classes but also requires the use of a module implementation, the abstract class is a special class, its special is that can only be inherited,
Collection: is an unordered, non-repeating combination of data.Main functions:Go heavy (Turn the list into a set automatically go to the weight)Relationship test test the intersection of two sets of data, difference set, and set of relationsThere
1.PIP InstallationExample: Pip Install DjangoYou can run pip in the scripts directory of the Python installation file to see the use Help2.tar.gz File InstallationAfter downloading the file, unzip the file, go to the Unzip directory, install it via
Date: 2017-04-23Address: Shahe City Iron A1 mouth right Turn right turn straight walk--hui Tak commercial building 401Python Basics ReviewFirst, language classificationC Language: Machine language-code executionPyPy: Bytecode-machine language-code
Windown under Dual version Python environment installation [@ Virtual machine][python3.6 Python2.7]First open a virtual machine, install WIN7SP1 above the environment, non-SP1 words python3.x installation will prompt the installation of more than n
An object is basically a collection of data (attributes) and a series of methods that can access and manipulate the data.class, which can be viewed as a kind, type, similar part extracted from a set of objects. All objects belong to a class, which
A __setattr__,__delattr__,__getattr__
__setattr__ #添加/Modify a property will trigger its execution
__delattr__ #删除属性的时候会触发
__getattr__ #只有在调用属性且属性不存在的时候才会触发
classFoo:def __init__(self,x): Self.name=xdef __setattr__(self, Key,
This article mainly introduces the reflection and introspection in Python, and the simple application of this mechanism.Programmers who are familiar with Java must often deal with class.forname. Even though this method is not often called personally,
This article mainly introduces the python implementation of Hill sort, has been programmed to implement the hill sort, with a certain reference value, interested in small partners can refer to
Take a look at "insert sort": It's not hard to see that
Python basic decorator and python basic decorator
Today, I will review the knowledge of the decorator that I have learned. When it comes to the decorator, the first reaction is that it is used for installation. Why, it should be because you can work
Python diary: crawler implementation based on Scrapy, pythonscrapy
Install the same version of pywin32 and python
Address https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/During installation, the system prompts that Python2.7 is
Enumerate () and map () function usage, enumeratemapI. python enumerate usage
First, let's get a question:
1. there is a list = [1, 2, 3, 4, 5, 6] Please Print the output: 0, 1 1, 2 2, 3 3, 4 4 4, 5 5, 6. Print the output, 2. returns a list in
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