Python string, numeric calculation, python string value

Source: Internet
Author: User

Python string, numeric calculation, python string value

Python is an object-oriented language, but it does not encapsulate standard classes into libraries like C ++. Instead, it further encapsulates the classes and functions of the language, such as print, list, dict etc. it brings great convenience to programming.

Python uses # to annotate a single line, and uses ''' or "" to annotate multiple lines

Numerical Calculation

>>> Print "One hour has", 60*60, "seconds" One hour has 3600 seconds >>> result = 12 # the same line of code uses space segments to make the format clearer >>> print result12

String

In Python, "" or ''is used to represent a string, and ''one sentence is used by a single word ""

>>> Print 'here is python' Here is Python >>> print "Here is Python, too" Here is Python, too

If non-ASCII characters are used in the text, you can add #-*-coding: UTF-8-*-to the python script -*-

Related Article

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.