Home > Article > Backend Development > python string, numerical calculation
Python is an object-oriented language, but it does not encapsulate all standard classes into libraries like C++. Instead, it carries out further encapsulation. The language itself integrates some classes and functions, such as print, list, dict etc. Brings great convenience to programming
Python uses # for single-line comments, and ''' or """” for multi-line comments
Numerical calculation
>>> print "One hour has", 60 * 60 , "seconds" One hour has 3600 seconds >>> result = 12 # 同一行代码利用空格分段使格式更清晰 >>> print result 12
String
In Python, "" or '' are used to represent strings. It is customary to use '' for a single word and "" for a sentence
>>> 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 -*-
at the beginning of the python script