A Concise Python tutorial

Source: Internet
Author: User

Linux Query Python version: Python-v

Linux enters Python:python

Exit Python:ctrl+d

Working with source files: helloworld.py

Run this program: Python helloworld.py

The directory is added to the PATH variable: path= $PATH:/home/swaroop/mydir completed. where "/home/swaroop/mydir" is the directory that I want to add to the path variable.

String usage in Python:

(1) using single quotation marks (')

this '

(2) Use double quotation marks (")

The string in double quotation marks is exactly the same as the string used in single quotation marks.

" What ' s your name? "

(3) Use three quotation marks ("' or '" ')

You can indicate a multi-line string by using the three quotation marks. You can use single and double quotation marks freely in three quotes.

" " This is a multi-line string. The first line. The second line. waht's your name?,   "" "

(4) Escape character

Output ' "\ in string, use \ \ \ \

Note: "This is the first sentence.\

This is the second sentence. " =====> is equivalent to "this is the first sentence. This is the second sentence. "

A Concise Python tutorial

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.