A byte of Python
Success in life is a matter not so much of talent and opportunity as of concentration and perseverance.
—- C.W. Wendte
Chapter 2. Introduction
Features of Python
- Simple
- Easy to Learn
- Free and Open Source
- High-level Language
- Portable
- Interpreted
- Object Oriented
- Extensible
- Embeddable???
- Extensive Libraries
Chapter 4. First Steps
- Vim
- PyCharm
- Emacs
Chapter 5. Basics
print("Hello, World!") #Note that print is a statement
- Constant:
- Numbers: (integers and float)
- Strings: (immutable)
- Single quote
- double quote
- triple quote: for multi-line string.
- format method
- format()
'{0:.3f}'.format(1.0/3)
'{0:_^11}'.format('Hello')
- escape sequences:\\ \n \t
- Raw string: no special processing
- Variable:
- Data Types:
- numbers
- strings
- classes
- Object
#程序可以换行
s = 'this is a string.\
This continues the string.'
print(s)
#same as
print(\
s)