Python Manuals 笔记

对于Python Manuals部分内容的笔记

Python Tutorial

Python Interpreter

special comment

#!/usr/bin/env python3
#-*- coding: cp1252 -*-

An Informal Introduction

Using Python as a Calculate

In interactive mode, the last printed expression is assigned to _ `

strings

immutable, can be sliced and indexed

r'C:\some\name' , the r can make the \n be not interpreted as special characters

use triple-quotes to present multiple lines. """...""" or '''...'''

add \ to avoid the new line.

strings next to each other can be automatically concatenated.

Lists

mutable, can be indexed and sliced

More Control Flow Tools

The range() function returns a iterable.

Loop statements can have a else clause, which is executed when the loop terminates through exhaustion of the iterable.
pass statements does nothing.

Defining Functions

When manipulating a variable, variable references first look in the local symbol table, then in the local symbol tables of enclosing functions, then in the global symbol table, then in the table of built-in names .

Default Argument Value

The Python Standard Library

posted @ 2020-08-31 22:02  DiffidentAres  阅读(248)  评论(0)    收藏  举报