Python string, numeric calculation

Source: Internet
Author: User
Python is an object-oriented language, but it does not encapsulate standard classes like C + + into libraries, but instead encapsulates them in a further way, and the language itself integrates classes and functions such as print,list,dict etc. Great convenience for programming

Python uses # for a single-line comment, using "or" "for multiline comments

Numerical calculation

>>> print "One Hour has", "seconds" one hour have 3600 seconds>>> result = 12 # The same line of code uses a space segment to make the format more Clear >>> Print result12

String

Use "" or "in Python to denote a string and use the word" "

>>> print ' Here's Python ' Here's python>>> print "Here's Python,too" Here's Python,too

If you use non-ASCII encoded characters in the text, you can add the #-*-coding:utf-8 to the Python script on the open-*-

  • 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.