python-Comments and strings

Source: Internet
Author: User

First, comments

1. #: Comment Line (shortcut key ctrl+/)

2, ' ' ' three quotation marks: Comment All the contents in quotation marks

Second, string

1, input () the type returned is a string

2. Strings can be enclosed in single or double quotation marks

1) If the string contains single quotes, the string is enclosed in double quotation marks.

2) If the string contains double quotation marks, the string is enclosed in single quotation marks.

3) If the character is swapped with single and double quotes, the string is enclosed in three quotation marks.

4) Operation Result:

3. Forced conversion of strings

1) convert character to int

2) force the string into float

3) Operation Result:

4. Related operation of string

1) Find

Printing results:

2) string Case conversion

Printing results:

3) string judgment

Printing results:

4) String Connection

Print STR3 display: Hello World

python-Comments and strings

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.