Woody's Python study Note 3, woodypython
Python Operators
Python logical operators
And Boolean and-if x is false, x and y returns false, otherwise it returns the calculated value of y.
Or Boolean or-if x is true, it returns true; otherwise, it returns the calculated value of y.
Not Boolean no-if x is true, false is returned. If x is false, true is returned.
Python member operators
Python supports member operators. The test instance contains a series of members, including strings, lists, or tuples.
In returns true if a value is found in the specified sequence. Otherwise, false is returned.
Not in returns true if no value is found in the specified sequence; otherwise, false.
Python identity Operators
Identity operators are used to compare the storage units of two objects.
Is to judge whether two identifiers are referenced from an object. If x is y, if id (x) is equal to id (y), is returns result 1.
Is not determines whether two identifiers reference different objects. x is not y. If id (x) is not equal to id (y), is returns result 1.
There is no switch statement in Python, instead of elif.
Python while LOOP statement
The While statement has two other important commands: continue, break to skip the loop. continue is used to skip this loop, and break is used to exit the loop.
Loop using else statements
In python,... Else indicates this. The statements in for are no different from those in general. The statements in else are executed after the loop is executed normally (that is, the for statements are not interrupted by the break jump, while... The same is true for else. If nested loops are used, the break statement stops executing the deepest loop and starts executing the next line of code.
The Python for loop can traverse any series of projects.
Another way to execute loop traversal is through indexes, such:
Len () returns the length of the list, that is, the number of elements.
Python pass is a null statement to guarantee the integrity of the program structure. It is meaningless.
I just learned Python and used Python30. I recommend a book for beginners.
The release of python3.0 is not long before. We recommend that you use more than 2.7, with less information and less answers to problems.
First look at the python simple tutorial, and then look at the python core programming.
After learning, you can easily develop a crawler tool. If you want to research the web, you can study django, which will make you excited!
This is my learning path.
I have always been helpful!
How to get started with python from? Or 2x?
My advice is to use the latest version, because when you get started, the latest module will come out, but it seems that 3.0 is not very stable, currently, we usually use 2.6. We recommend that you study it in the ubuntu system. This will reduce the trouble of detours and installation.