Python 3 最常用函数(最全的查询)

介绍

  • Python (python.org)
  • Learn X in Y minutes (learnxinyminutes.com)
  • Regex in python (quickref.me)

Hello World

>>> print("Hello, World!")

Hello, World!

Python 中著名的“Hello World”程序

变量

age = 18      # 年龄是 int 类型

name = "John" # name 现在是 str 类型

print(name)

Python 不能在没有赋值的情况下声明变量

数据类型

str

Text

int, float, complex

Numeric

list, tuple, range

Sequence

dict

Mapping

set, frozenset

Set

bool

Boolean

bytes, bytearray, memoryview

Binary

查看: Data Types

Slicing String

>>> msg = "Hello, World!"

>>> print(msg[2:5])

llo

查看: Strings

Lists

mylist = []

mylist.append(1)

mylist.append(2)

for item in mylist:

    print(item) # 打印输出 1,2

查看: Lists

If Else

num = 200

if num > 0:

    print("num is greater than 0")

else:

    print("num is not greater than 0")

查看: 流程控制

循环

for item in range(6):

    if item == 3: break

    print(item)

else:

    print("Finally finished!")

查看: Loops

函数

>>> def my_function():

...     print("来自函数的你好")

...

>>> my_function()

来自函数的你好

查看: Functions

文件处理

with open("myfile.txt", "r", encoding='utf8') as file:

    for line in file:

        print(line)

查看: 文件处理

算术

result = 10 + 30 # => 40

result = 40 - 10 # => 30

result = 50 * 5  # => 250

result = 16 / 4  # => 4.0 (Float Division)

result = 16 // 4 # => 4 (Integer Division)

result = 25 % 2  # => 1

result = 5 ** 3  # => 125

/ 表示 x 和 y 的商,// 表示 x 和 y 的底商,另见 StackOverflow

加等于

counter = 0

counter += 10           # => 10

counter = 0

counter = counter + 10  # => 10

message = "Part 1."

# => Part 1.Part 2.

message += "Part 2."  

f-字符串(Python 3.6+)

>>> website = 'Quickref.ME'

>>> f"Hello, {website}"

"Hello, Quickref.ME"

>>> num = 10

>>> f'{num} + 10 = {num + 10}'

'10 + 10 = 20'

查看: Python F-Strings

Python 数据类型

字符串

hello = "Hello World"

hello = 'Hello World'

multi_string = """Multiline Strings

Lorem ipsum dolor sit amet,

consectetur adipiscing elit """

查看: Strings

数字

x = 1    # int

y = 2.8  # float

z = 1j   # complex

>>> print(type(x))

<class 'int'>

布尔值

my_bool = True

my_bool = False

bool(0)     # => False

bool(1)     # => True

Lists

list1 = ["apple", "banana", "cherry"]

list2 = [True, False, False]

list3 = [1, 5, 7, 9, 3]

list4 = list((1, 5, 7, 9, 3))

查看: Lists

元组 Tuple

my_tuple = (1, 2, 3)

my_tuple = tuple((1, 2, 3))

类似于 List 但不可变

Set

set1 = {"a", "b", "c"}  

set2 = set(("a", "b", "c"))

一组独特的项目/对象

字典 Dictionary

>>> empty_dict = {}

>>> a = {"one": 1, "two": 2, "three": 3}

>>> a["one"]

1

>>> a.keys()

dict_keys(['one', 'two', 'three'])

>>> a.values()

dict_values([1, 2, 3])

>>> a.update({"four": 4})

>>> a.keys()

dict_keys(['one', 'two', 'three', 'four'])

>>> a['four']

4

Key:值对,JSON 类对象

Casting

整数 Integers

x = int(1)       # x 将是 1

y = int(2.8)     # y 将是 2

z = int("3")     # z 将是 3

浮点数 Floats

x = float(1)     # x 将为 1.0

y = float(2.8)   # y 将是 2.8

z = float("3")   # z 将为 3.0

w = float("4.2") # w 将是 4.2

字符串 Strings

x = str("s1")    # x 将是 's1'

y = str(2)       # y 将是 '2'

z = str(3.0)     # z 将是 '3.0'

Python 字符串

类数组

>>> hello = "Hello, World"

>>> print(hello[1])

e

>>> print(hello[-1])

d

获取位置 1 或最后的字符

循环

>>> for char in "foo":

...     print(char)

f

o

o

遍历单词 foo 中的字母

切片字符串

 ┌───┬───┬───┬───┬───┬───┬───┐

 | m | y | b | a | c | o | n |

 └───┴───┴───┴───┴───┴───┴───┘

 0   1   2   3   4   5   6   7

-7  -6  -5  -4  -3  -2  -1


>>> s = 'mybacon'

>>> s[2:5]

'bac'

>>> s[0:2]

'my'


>>> s = 'mybacon'

>>> s[:2]

'my'

>>> s[2:]

'bacon'

>>> s[:2] + s[2:]

'mybacon'

>>> s[:]

'mybacon'


>>> s = 'mybacon'

>>> s[-5:-1]

'baco'

>>> s[2:6]

'baco'

迈着大步

>>> s = '12345' * 5

>>> s

'1234512345123451234512345'

>>> s[::5]

'11111'

>>> s[4::5]

'55555'

>>> s[::-5]

'55555'

>>> s[::-1]

'5432154321543215432154321'

字符串长度

>>> hello = "Hello, World!"

>>> print(len(hello))

13

len() 函数返回字符串的长度

多份

>>> s = '===+'

>>> n = 8

>>> s * n

'===+===+===+===+===+===+===+===+'

检查字符串

>>> s = 'spam'

>>> s in 'I saw spamalot!'

True

>>> s not in 'I saw The Holy Grail!'

True

连接

>>> s = 'spam'

>>> t = 'egg'

>>> s + t

'spamegg'

>>> 'spam' 'egg'

'spamegg'

格式化

name = "John"

print("Hello, %s!" % name)


name = "John"

age = 23

print("%s is %d years old." % (name, age))

format() 方法

txt1 = "My name is {fname}, I'm {age}".format(fname="John", age=36)

txt2 = "My name is {0}, I'm {1}".format("John", 36)

txt3 = "My name is {}, I'm {}".format("John", 36)

Input 输入

>>> name = input("Enter your name: ")

Enter your name: Tom

>>> name

'Tom'

从控制台获取输入数据

Join 加入

>>> "#".join(["John", "Peter", "Vicky"])

'John#Peter#Vicky'

Endswith 以..结束

>>> "Hello, world!".endswith("!")

True

Python F 字符串(自 Python 3.6+ 起)

f-Strings 用法

>>> website = 'Reference'

>>> f"Hello, {website}"

"Hello, Reference"

>>> num = 10

>>> f'{num} + 10 = {num + 10}'

'10 + 10 = 20'

>>> f"""He said {"I'm John"}"""

"He said I'm John"

>>> f'5 {"{stars}"}'

'5 {stars}'

>>> f'{{5}} {"stars"}'

'{5} stars'

>>> name = 'Eric'

>>> age = 27

>>> f"""Hello!

...     I'm {name}.

...     I'm {age}."""

"Hello!\n    I'm Eric.\n    I'm 27."

它从 Python 3.6 开始可用,另见: 格式化的字符串文字

f-Strings 填充对齐

>>> f'{"text":10}'   # [宽度]

'text      '

>>> f'{"test":*>10}' # 向左填充

'******test'

>>> f'{"test":*<10}' # 填写正确

'test******'

>>> f'{"test":*^10}' # 填充中心

'***test***'

>>> f'{12345:0>10}'  # 填写数字

'0000012345'

f-Strings 类型

>>> f'{10:b}'     # binary 二进制类型

'1010'

>>> f'{10:o}'     # octal 八进制类型

'12'

>>> f'{200:x}'    # hexadecimal 十六进制类型

'c8'

>>> f'{200:X}'

'C8'

>>> f'{345600000000:e}' # 科学计数法

'3.456000e+11'

>>> f'{65:c}'       # 字符类型

'A'

>>> f'{10:#b}'      # [类型] 带符号(基础)

'0b1010'

>>> f'{10:#o}'

'0o12'

>>> f'{10:#x}'

'0xa'

F-Strings Sign

>>> f'{12345:+}'      # [sign] (+/-)

'+12345'

>>> f'{-12345:+}'

'-12345'

>>> f'{-12345:+10}'

'    -12345'

>>> f'{-12345:+010}'

'-000012345'

F-Strings 其它

>>> f'{-12345:0=10}'  # 负数

'-000012345'

>>> f'{12345:010}'    # [0] 快捷方式(不对齐)

'0000012345'

>>> f'{-12345:010}'

'-000012345'

>>> import math       # [.precision]

>>> math.pi

3.141592653589793

>>> f'{math.pi:.2f}'

'3.14'

>>> f'{1000000:,.2f}' # [分组选项]

'1,000,000.00'

>>> f'{1000000:_.2f}'

'1_000_000.00'

>>> f'{0.25:0%}'      # 百分比

'25.000000%'

>>> f'{0.25:.0%}'

'25%'

Python Lists

定义

>>> li1 = []

>>> li1

[]

>>> li2 = [4, 5, 6]

>>> li2

[4, 5, 6]

>>> li3 = list((1, 2, 3))

>>> li3

[1, 2, 3]

>>> li4 = list(range(1, 11))

>>> li4

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

生成

>>> list(filter(lambda x : x % 2 == 1, range(1, 20)))

[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]

>>> [x ** 2 for x in range (1, 11) if  x % 2 == 1]

[1, 9, 25, 49, 81]

>>> [x for x in [3, 4, 5, 6, 7] if x > 5]

[6, 7]

>>> list(filter(lambda x: x > 5, [3, 4, 5, 6, 7]))

[6, 7]

添加

>>> li = []

>>> li.append(1)

>>> li

[1]

>>> li.append(2)

>>> li

[1, 2]

>>> li.append(4)

>>> li

[1, 2, 4]

>>> li.append(3)

>>> li

[1, 2, 4, 3]

List 切片

列表切片的语法:

a_list[start:end]

a_list[start:end:step]

切片

>>> a = ['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']

>>> a[2:5]

['bacon', 'tomato', 'ham']

>>> a[-5:-2]

['egg', 'bacon', 'tomato']

>>> a[1:4]

['egg', 'bacon', 'tomato']

省略索引

>>> a[:4]

['spam', 'egg', 'bacon', 'tomato']

>>> a[0:4]

['spam', 'egg', 'bacon', 'tomato']

>>> a[2:]

['bacon', 'tomato', 'ham', 'lobster']

>>> a[2:len(a)]

['bacon', 'tomato', 'ham', 'lobster']

>>> a

['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']

>>> a[:]

['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']

迈着大步

['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']

>>> a[0:6:2]

['spam', 'bacon', 'ham']

>>> a[1:6:2]

['egg', 'tomato', 'lobster']

>>> a[6:0:-2]

['lobster', 'tomato', 'egg']

>>> a

['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']

>>> a[::-1]

['lobster', 'ham', 'tomato', 'bacon', 'egg', 'spam']

删除

>>> li = ['bread', 'butter', 'milk']

>>> li.pop()

'milk'

>>> li

['bread', 'butter']

>>> del li[0]

>>> li

['butter']

使用权

>>> li = ['a', 'b', 'c', 'd']

>>> li[0]

'a'

>>> li[-1]

'd'

>>> li[4]

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

IndexError: list index out of range

连接

>>> odd = [1, 3, 5]

>>> odd.extend([9, 11, 13])

>>> odd

[1, 3, 5, 9, 11, 13]

>>> odd = [1, 3, 5]

>>> odd + [9, 11, 13]

[1, 3, 5, 9, 11, 13]

排序和反转

>>> li = [3, 1, 3, 2, 5]

>>> li.sort()

>>> li

[1, 2, 3, 3, 5]

>>> li.reverse()

>>> li

[5, 3, 3, 2, 1]

计数

>>> li = [3, 1, 3, 2, 5]

>>> li.count(3)

2

重复

>>> li = ["re"] * 3

>>> li

['re', 're', 're']

Python 流程控制

基本

num = 5

if num > 10:

    print("num is totally bigger than 10.")

elif num < 10:

    print("num is smaller than 10.")

else:

    print("num is indeed 10.")

一行

>>> a = 330

>>> b = 200

>>> r = "a" if a > b else "b"

>>> print(r)

a

else if

value = True

if not value:

    print("Value is False")

elif value is None:

    print("Value is None")

else:

    print("Value is True")

Python 循环

基础

primes = [2, 3, 5, 7]

for prime in primes:

    print(prime)

有索引

animals = ["dog", "cat", "mouse"]

for i, value in enumerate(animals):

    print(i, value)

While

x = 0

while x < 4:

    print(x)

    x += 1  # Shorthand for x = x + 1

Break

x = 0

for index in range(10):

    x = index * 10

    if index == 5:

               break

    print(x)

Continue

for index in range(3, 8):

    x = index * 10

    if index == 5:

               continue

    print(x)

范围

for i in range(4):

    print(i) # Prints: 0 1 2 3

for i in range(4, 8):

    print(i) # Prints: 4 5 6 7

for i in range(4, 10, 2):

    print(i) # Prints: 4 6 8

使用 zip()

name = ['Pete', 'John', 'Elizabeth']

age = [6, 23, 44]

for n, a in zip(name, age):

    print('%s is %d years old' %(n, a))

列表理解

result = [x**2 for x in range(10) if x % 2 == 0]

 

print(result)

# [0, 4, 16, 36, 64]

Python 函数

基础

def hello_world(): 

    print('Hello, World!')

返回

def add(x, y):

    print("x is %s, y is %s" %(x, y))

    return x + y

add(5, 6)    # => 11

位置参数

def varargs(*args):

    return args

varargs(1, 2, 3# => (1, 2, 3)

关键字参数

def keyword_args(**kwargs):

    return kwargs

# => {"big": "foot", "loch": "ness"}

keyword_args(big="foot", loch="ness")

返回多个

def swap(x, y):

    return y, x

x = 1

y = 2

x, y = swap(x, y)  # => x = 2, y = 1

默认值

def add(x, y=10):

    return x + y

add(5)      # => 15

add(5, 20# => 25

匿名函数

# => True

(lambda x: x > 2)(3)

# => 5

(lambda x, y: x ** 2 + y ** 2)(2, 1)

Python 模块

导入模块

import math

print(math.sqrt(16))  # => 4.0

从一个模块导入

from math import ceil, floor

print(ceil(3.7))   # => 4.0

print(floor(3.7))  # => 3.0

全部导入

from math import *

缩短模块

import math as m

# => True

math.sqrt(16) == m.sqrt(16)

功能和属性

import math

dir(math)

Python 文件处理

读取文件

逐行

with open("myfile.txt") as file:

    for line in file:

        print(line)

带行号

file = open('myfile.txt', 'r')

for i, line in enumerate(file, start=1):

    print("Number %s: %s" % (i, line))

字符串

写一个字符串

contents = {"aa": 12, "bb": 21}

with open("myfile1.txt", "w+") as file:

    file.write(str(contents))

读取一个字符串

with open('myfile1.txt', "r+") as file:

    contents = file.read()

print(contents)

对象

写一个对象

contents = {"aa": 12, "bb": 21}

with open("myfile2.txt", "w+") as file:

    file.write(json.dumps(contents))

读取对象

with open('myfile2.txt', "r+") as file:

    contents = json.load(file)

print(contents)

删除文件

import os

os.remove("myfile.txt")

检查和删除

import os

if os.path.exists("myfile.txt"):

    os.remove("myfile.txt")

else:

    print("The file does not exist")

删除文件夹

import os

os.rmdir("myfolder")

Python 类和继承

Defining

class MyNewClass:

    pass

# Class Instantiation

my = MyNewClass()

构造函数

class Animal:

    def __init__(self, voice):

        self.voice = voice

 

cat = Animal('Meow')

print(cat.voice)    # => Meow

 

dog = Animal('Woof')

print(dog.voice)    # => Woof

方法

class Dog:

    # 类的方法

    def bark(self):

        print("Ham-Ham")

 

charlie = Dog()

charlie.bark()   # => "Ham-Ham"

类变量

class MyClass:

    class_variable = "A class variable!"

# => 一个类变量!

print(MyClass.class_variable)

x = MyClass()

 

# => 一个类变量!

print(x.class_variable)

Super() 函数

class ParentClass:

    def print_test(self):

        print("Parent Method")

 

class ChildClass(ParentClass):

    def print_test(self):

        print("Child Method")

        # 调用父级的 print_test()

        super().print_test()


>>> child_instance = ChildClass()

>>> child_instance.print_test()

Child Method

Parent Method

repr() 方法

class Employee:

    def __init__(self, name):

        self.name = name

 

    def __repr__(self):

        return self.name

 

john = Employee('John')

print(john)  # => John

用户定义的异常

class CustomError(Exception):

    pass

多态性

class ParentClass:

    def print_self(self):

        print('A')

 

class ChildClass(ParentClass):

    def print_self(self):

        print('B')

 

obj_A = ParentClass()

obj_B = ChildClass()

 

obj_A.print_self() # => A

obj_B.print_self() # => B

覆盖

class ParentClass:

    def print_self(self):

        print("Parent")

 

class ChildClass(ParentClass):

    def print_self(self):

        print("Child")

 

child_instance = ChildClass()

child_instance.print_self() # => Child

继承

class Animal:

    def __init__(self, name, legs):

        self.name = name

        self.legs = legs

       

class Dog(Animal):

    def sound(self):

        print("Woof!")

 

Yoki = Dog("Yoki", 4)

print(Yoki.name) # => YOKI

print(Yoki.legs) # => 4

Yoki.sound()     # => Woof!

各种各样的

注释

# 这是单行注释


""" 可以写多行字符串

    使用三个",并且经常使用

    作为文档。

"""


''' 可以写多行字符串

    使用三个',并且经常使用

    作为文档。

'''

生成器

def double_numbers(iterable):

    for i in iterable:

        yield i + i

生成器可帮助您编写惰性代码

要列出的生成器

values = (-x for x in [1,2,3,4,5])

gen_to_list = list(values)

# => [-1, -2, -3, -4, -5]

print(gen_to_list)

处理异常

try:

    # 使用“raise”来引发错误

    raise IndexError("这是一个索引错误")

except IndexError as e:

    pass                 # 通行证只是一个空操作。 通常你会在这里做恢复。

except (TypeError, NameError):

    pass                 # 如果需要,可以一起处理多个异常。

else:                    # try/except 块的可选子句。 必须遵循除块之外的所有内容

    print("All good!")   # 仅当 try 中的代码未引发异常时运行

finally:                 # 在所有情况下执行

    print("我们可以在这里清理资源")

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目录: 01 教程.png 01.01 2.x与3.x版本区别.png 02 基础语法.png 02.01 命令行参数.png 03 基本数据类型.png 03.01 数据类型转换 int() 函数.png 03.02 数据类型转换 float() 函数.png 03.03 数据类型转换 complex() 函数.png 03.04 数据类型转换 str() 函数.png 03.05 数据类型转换 repr() 函数.png 03.06 数据类型转换 eval() 函数.png 03.07 数据类型转换 tuple 函数.png 03.08 数据类型转换 list()方法.png 03.09 数据类型转换 set() 函数.png 03.10 数据类型转换 dict() 函数.png 03.11 数据类型转换 frozenset() 函数.png 03.12 数据类型转换 chr() 函数.png 03.13 数据类型转换 ord() 函数.png 03.14 数据类型转换 hex() 函数.png 03.15 数据类型转换 oct() 函数.png 04 解释器.png 05 注释.png 06 运算符.png 07 数字(Number).png 07.01 数学函数 abs() 函数.png 07.02 数学函数 ceil() 函数.png 07.03 数学函数 exp() 函数.png 07.04 数学函数 fabs() 函数.png 07.05 数学函数 floor() 函数.png 07.06 数学函数 log() 函数.png 07.07 数学函数 log10() 函数.png 07.08 数学函数 max() 函数.png 07.09 数学函数 min() 函数.png 07.10 数学函数 modf() 函数.png 07.11 数学函数 pow() 函数.png 07.12 数学函数 round() 函数.png 07.13 数学函数 sqrt() 函数.png 07.14 随机数函数 choice() 函数.png 07.15 随机数函数 randrange() 函数.png 07.16 随机数函数 random() 函数.png 07.17 随机数函数 seed() 函数.png 07.18 随机数函数 shuffle() 函数.png 07.19 随机数函数 uniform() 函数.png 07.20 三角函数 acos() 函数.png 07.21 三角函数 asin() 函数.png 07.22 三角函数 atan() 函数.png 07.23 三角函数 atan2() 函数.png 07.24 三角函数 cos() 函数.png 07.25 三角函数 hypot() 函数.png 07.26 三角函数 sin() 函数.png 07.27 三角函数 tan() 函数.png 07.28 三角函数 degrees() 函数.png 07.29 三角函数 radians() 函数.png 08 字符串.png 08.01 字符串内建函数 capitalize()方法.png 08.02 字符串内建函数 center()方法.png 08.03 字符串内建函数 count()方法.png 08.04 字符串内建函数 bytes.decode()方法.png 08.05 字符串内建函数 encode()方法.png 08.06 字符串内建函数 endswith()方法.png 08.07 字符串内建函数 expandtabs()方法.png 08.08 字符串内建函数 find()方法.png 08.09 字符串内建函数 index()方法.png 08.10 字符串内建函数 isalnum()方法.png 08.11 字符串内建函数 isalpha()方法.png 08.12 字符串内建函数 isdigit()方法.png 08.13 字符串内建函数 islower()方法.png 08.14 字符串内建函数 isnumeric()方法.png 08.15 字符串内建函数 isspace()方法.png 08.16 字符串内建函数 istitle()方法.png 08.17 字符串内建函数 isupper()方法.png 08.18 字符串内建函数 join()方法.png 08.19 字符串内建函数 len()方法.png 08.20 字符串内建函数 ljust()方法.png 08.21 字符串内建函数 lower()方法.png 08.22 字符串内建函数 lstrip()方法.png 08.23 字符串内建函数 maketrans()方法.png 08.24 字符串内建函数 max()方法.png 08.25 字符串内建函数 min()方法.png 08.26 字符串内建函数 replace()方法.png 08.27 字符串内建函数 rfind()方法.png 08.28 字符串内建函数 rindex()方法.png 08.29 字符串内建函数 rjust()方法.png 08.30 字符串内建函数 rstrip()方法.png 08.31 字符串内建函数 split()方法.png 08.32 字符串内建函数 splitlines()方法.png 08.33 字符串内建函数 startswith()方法.png 08.34 字符串内建函数 strip()方法.png 08.35 字符串内建函数 swapcase()方法.png 08.36 字符串内建函数 title()方法.png 08.37 字符串内建函数 translate()方法.png 08.38 字符串内建函数 upper()方法.png 08.39 字符串内建函数 zfill()方法.png 08.40 字符串内建函数 isdecimal()方法.png 09 列.png 09.01 列函数 List len()方法.png 09.02 列函数 List max()方法.png 09.03 列函数 List min()方法.png 09.04 列函数 List list()方法.png 09.05 列方法 List append()方法.png 09.06 列方法 List count()方法.png 09.07 列方法 List extend()方法.png 09.08 列方法 List index()方法.png 09.09 列方法 List insert()方法.png 09.10 列方法 List pop()方法.png 09.11 列方法 List remove()方法.png 09.12 列方法 List reverse()方法.png 09.13 列方法 List sort()方法.png 09.14 列方法 List clear()方法.png 09.15 列方法 List copy()方法.png 10 元组.png 11 字典.png 11.01 字典 clear()方法.png 11.02 字典 copy()方法.png 11.02.01 直接赋值、浅拷贝和深度拷贝解析.png 11.03 字典 fromkeys()方法.png 11.04 字典 get() 方法.png 11.05 字典 in 操作符.png 11.06 字典 items() 方法.png 11.07 字典 keys() 方法.png 11.08 字典 setdefault() 方法.png 11.09 字典 update() 方法.png 11.10 字典 values() 方法.png 11.11 字典 pop() 方法.png 11.12 字典 popitem() 方法.png 12 编程第一步.png 13 条件控制.png 14 循环语句.png 15 迭代器与生成器.png 16 函数.png 17 数据结构.png 18 模块.png 19 输入和输出.png 20 File 方法.png 20.01 File close() 方法.png 20.02 File flush() 方法.png 20.03 File fileno() 方法.png 20.04 File isatty() 方法.png 20.05 File next() 方法.png 20.06 File read() 方法.png 20.07 File readline() 方法.png 20.08 File readlines() 方法.png 20.09 File seek() 方法.png 20.10 File tell() 方法.png 20.11 File truncate() 方法.png 20.12 File write() 方法.png 20.13 File writelines() 方法.png 21 OS 文件_目录方法.png 21.01 os.access() 方法.png 21.02 os.chdir() 方法.png 21.03 os.chflags() 方法.png 21.04 os.chmod() 方法.png 21.05 os.chown() 方法.png 21.06 os.chroot() 方法.png 21.07 os.close() 方法.png 21.08 os.closerange() 方法.png 21.09 os.dup() 方法.png 21.10 os.dup2() 方法.png 21.11 os.fchdir() 方法.png 21.12 os.fchmod() 方法.png 21.13 os.fchown() 方法.png 21.14 os.fdatasync() 方法.png 21.15 os.fdopen() 方法.png 21.16 os.fpathconf() 方法.png 21.17 os.fstat() 方法.png 21.18 os.fstatvfs() 方法.png 21.19 os.fsync() 方法.png 21.20 os.ftruncate() 方法.png 21.21 os.getcwd() 方法.png 21.22 os.getcwdu() 方法.png 21.23 os.isatty() 方法.png 21.24 os.lchflags() 方法.png 21.25 os.lchmod() 方法.png 21.26 os.lchown() 方法.png 21.27 os.link() 方法.png 21.28 os.listdir() 方法.png 21.29 os.lseek() 方法.png 21.30 os.lstat() 方法.png 21.31 os.major() 方法.png 21.32 os.makedev() 方法.png 21.33 os.makedirs() 方法.png 21.34 os.minor() 方法.png 21.35 os.mkdir() 方法.png 21.36 os.mkfifo() 方法.png 21.37 os.mknod() 方法.png 21.38 os.open() 方法.png 21.39 os.openpty() 方法.png 21.40 os.pathconf() 方法.png 21.41 os.pipe() 方法.png 21.42 os.popen() 方法.png 21.43 os.read() 方法.png 21.44 os.readlink() 方法.png 21.45 os.remove() 方法.png 21.46 os.removedirs() 方法.png 21.47 os.rename() 方法.png 21.48 os.renames() 方法.png 21.49 os.rmdir() 方法.png 21.50 os.stat() 方法.png 21.51 os.stat_float_times() 方法.png 21.52 os.statvfs() 方法.png 21.53 os.symlink() 方法.png 21.54 os.tcgetpgrp() 方法.png 21.55 os.tcsetpgrp() 方法.png 21.56 os.ttyname() 方法.png 21.57 os.unlink() 方法.png 21.58 os.utime() 方法.png 21.59 os.walk() 方法.png 21.60 os.write() 方法.png 22 错误和异常.png 23 面向对象.png 24 标准库概览.png 25 实例.png 25.01 Hello World 实例.png 25.02 数字求和.png 25.03 平方根.png 25.04 二次方程.png 25.05 计算三角形的面积.png 25.06 随机数生成.png 25.07 摄氏温度转华氏温度.png 25.08 交换变量.png 25.09 if 语句.png 25.10 判断字符串是否为数字.png 25.11 判断奇数偶数.png 25.12 判断闰年.png 25.13 获取最大值函数.png 25.14 质数判断.png 25.15 输出指定范围内的素数.png 25.16 阶乘实例.png 25.17 九九乘法.png 25.18 斐波那契数列.png 25.19 阿姆斯特朗数.png 25.20 十进制转二进制、八进制、十六进制.png 25.21 ASCII码与字符相互转换.png 25.22 最大公约数算法.png 25.23 最小公倍数算法.png 25.24 简单计算器实现.png 25.25 生成日历.png 25.26 使用递归斐波那契数列.png 25.27 文件 IO.png 25.28 字符串判断.png 25.29 字符串大小写转换.png 25.30 计算每个月天数.png 25.31 获取昨天日期.png 25.32 list 常用操作.png 26 正则达式.png 27 CGI编程.png 28 MySQL 数据库连接.png 29 网络编程.png 30 SMTP发送邮件.png 31 多线程.png 32 XML解析.png 33 JSON 数据解析.png 34 日期和时间.png 34.01 time clock()方法.png 34.02 time mktime()方法.png 34.03 time tzset()方法.png 35 内置函数.png 35.01 abs() 函数.png 35.02 all() 函数.png 35.03 any() 函数.png 35.04 ascii() 函数.png 35.05 bin() 函数.png 35.06 bool() 函数.png 35.07 bytearray() 函数.png 35.08 bytes 函数.png 35.09 callable() 函数.png 35.10 chr() 函数.png 35.11 classmethod 修饰符.png 35.12 compile() 函数.png 35.13 complex() 函数.png 35.14 delattr() 函数.png 35.15 dict() 函数.png 35.16 dir() 函数.png 35.17 divmod() 函数.png 35.18 enumerate() 函数.png 35.19 eval() 函数.png 35.20 exec 函数.png 35.21 filter() 函数.png 35.22 float() 函数.png 35.23 format 格式化函数.png 35.24 frozenset() 函数.png 35.25 getattr() 函数.png 35.26 globals() 函数.png 35.27 hasattr() 函数.png 35.28 hash() 函数.png 35.29 help() 函数.png 35.30 hex() 函数.png 35.31 id() 函数.png 35.32 input() 函数.png 35.33 int() 函数.png 35.34 isinstance() 函数.png 35.35 issubclass() 函数.png 35.36 iter() 函数.png 35.37 len()方法.png 35.38 list()方法.png 35.39 locals() 函数.png 35.40 map() 函数.png 35.41 max() 函数.png 35.42 memoryview() 函数.png 35.43 min() 函数.png 35.44 next() 函数.png 35.45 oct() 函数.png 35.46 open() 函数.png 35.47 ord() 函数.png 35.48 pow() 函数.png 35.49 print() 函数.png 35.50 property() 函数.png 35.51 range() 函数用法.png 35.52 repr() 函数.png 35.53 reversed 函数.png 35.54 round() 函数.png 35.55 set() 函数.png 35.56 setattr() 函数.png 35.57 slice() 函数.png 35.58 sorted() 函数.png 35.59 staticmethod() 函数.png 35.60 str() 函数.png 35.61 sum() 函数.png 35.62 super() 函数.png 35.63 tuple 函数.png 35.64 type() 函数.png 35.65 vars() 函数.png 35.66 zip() 函数.png 35.67 __import__() 函数.png
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值