- Published: June 11, 2017
Python language core concepts1:
- Python is a programming language that offers much more structure and support for large programs than shell scripts or batch files.
- Python has high-level data types built in, such as flexible arrays and dictionaries.
- Python allows you to split your program into modules that can be reused in other Python programs. It comes with a large collection of standard modules that you can use as the basis of your programs
- Python is an interpreted language, no compilation and linking is necessary. The interpreter can be used interactively.
- Statement grouping is done by indentation instead of beginning and ending brackets;
- no variable or argument declarations are necessary.
- Python is extensible, easy to add a new built-in function or module to the interpreter.
Python commands can handle arguments with the
sys module. The script
name and additional arguments are turned into a list of strings and
assigned to the
argv variable in the
sys module. This list is
accessible after executing
import sys, for example with
By default, Python source files are treated
in UTF-8, this is equivalent to having
# -*- coding: utf-8 -*- in
- class int(x=0)
- class int(x, base=10)
- Return an integer object constructed from a number or string x, or return 0 if no arguments are given
- class float([x])
- Return a floating point number constructed from a number or string x.
- class decimal.Decimal(value=“0”, context=None)¶
- Construct a new Decimal object based from value.
- [sign] numerator [‘/’ denominator]
- A Fraction instance can be constructed from a pair of integers, from another rational number, or from a string.
other rational number, or from a string.
And even complex numbers, (using j or J suffix to indicate the imaginary part e.g. 3+5j)