Python Learning notes Clutter a piece

Source: Internet
Author: User


Output summary

>>>print (' Helllo World ') >>>print ("Hello World")

The output is same.

>>>print (>>>print) (3*5)

Print () If you lose a string of text, enclose it in quotation marks or ", if it is a number.

>>>a=[1,3]>>>print (2 in a) false

Python can output logical outcome.


Explain the idle problem, in command-line mode, you can only enter one line at a time, if you want to complete multiple lines of command input at the same time, you can create a new file, enter multiple commands, save, and then run. (seems to have something to do with the batch of documents?) I don't know, I'm a novice)


Data type


Python consists of four basic data types, integer, float, String, and Boolean (BOOL)

The bool type contains two values, True and false, to indicate that the logic is "non". Numbers include integers, long integers, floating-point numbers, complex numbers (6+8j).

>>>wu= ' abd ' < ' erh ' >>>wu>>>true


If statement

If condition statement: Execute statement




Note that the colon cannot be omitted, the inner statement must have a uniform indentation, typically four spaces, or a tab;python in place of other symbols, such as {}, but the entire file needs to be indented, either all spaces, or all tabs, generally recommended spaces


Quotes

About the quotation marks, puzzled for a long time, and now summarize;

Single and double quotes are basically no different, three quotes (three single quotes or three double quotes) are special, and with three quotes, you can indicate a multiline string. You can use single and double quotation marks freely in three quotation marks.

"This is a multi-line string. The first line. The second line. What ' s your name?, "I asked. He said "Bond, James bond."

Two ways to represent what ' s your name

' what\ ' Your name? ' " What ' s your name? "

Similarly, to use the double quotation mark itself in a double-quoted string , you can also help with the escape character. Alternatively, you can use the escape character \ \ to indicate the backslash itself .


This article has intercepted elsewhere, because too much too miscellaneous is not easy to spread, this article for my own viewing, so no longer indicate the source. Hereby DECLARE.


This article is from the "Hell Yo" blog, please be sure to keep this source http://hellyou.blog.51cto.com/12853112/1922902

Python Learning notes Clutter a piece

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.