![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python初级范例
记录python的初级学习中经常使用的脚本范例
weixin_mailong
八戒八戒、师傅被抓了
展开
-
Python简单范例04【从标准库导入】&【文档操作】
范例一:【导入OrderedDict类】 from collections import OrderedDict favorite_languages = OrderedDict() favorite_languages['jen'] = 'python' favorite_languages['sarah'] = 'c' favorite_languages['edward'] = 'r...原创 2019-11-10 07:59:46 · 195 阅读 · 0 评论 -
Python简单范例03【类】
范例一:创建一个"狗的类" #coding:utf-8 class Dog(): #一次模拟小狗的简单尝试 #可将类视为有关如何创建实例的说明。Dog 类是一系列说明,让Python知道如何创建表示特定小狗的实例。 def __init__(self,name,age): ##此处是前后两个下划线“__”init"_ _" #初始化属性name和ag...原创 2019-11-08 23:21:18 · 135 阅读 · 0 评论 -
Python简单范例02【模块操作】
范例一:导入函数模块 #coding:utf-8 def make_pizza(size,*toppings): #概述要制作的披萨 print("\nMaking a " + str(size) + "-inch pizza with the following toppings:") for topping in toppings: print("- " + topping)...原创 2019-11-07 09:18:45 · 98 阅读 · 0 评论 -
python简单范例01
范例一: pets = ['dog','cat','dog','goldfish','cat','rabbit','cat'] print(pets) while 'cat' in pets: pets.remove('cat') print(pets) print("###") print(pets) 范例二: responses = {} polling_active = True ...原创 2019-11-06 15:28:17 · 130 阅读 · 0 评论