1.第一步 下载py文件:https://bootstrap.pypa.io/ez_setup.py #!/usr/bin/env python """ Setuptools bootstrapping installer. Maintained at https://github.com/pypa/setuptools/tree/bootstrap. Run this script to install or upgrade setuptools. ""…
类实现wsgi app from wsgiref.util import setup_testing_defaults from wsgiref.simple_server import make_server class Simple_App: def __init__(self,environ,start_response): self.environ = environ self.start_response =start_response status = '200 ok' header…
#一,集合类型###找出两个集合的交集并将结果打印出来# python_stu=['egon','alex','kevin','王大炮','李二丫']# linux_stu=['张铁蛋','刘铜蛋','赵金蛋','alex','kevin','oldboy']# res=[]# for stu1 in python_stu:# if stu1 in linux_stu:# res.append(stu1)# print(res)##2 集合# 定义方式:在{}用逗号分割开多个元素,但是集合内元素…
引入模块的方式: 1. import 模块 2. from xxx import 模块 一.collections 模块 1.Counter() counter是一个计数器,主要用来计数,计算一个字符串中每个字符出现的次数 from collections import Counter s = "我要从南走到北,还要从北走到南" ret = Counter(s) print("__iter__" in dir(ret)) for item in ret: print…
一.三个内置函数 1.issubclass(a, b) 判断a类是否是b类的子类 class Foo: pass class Zi(Foo): pass class Sun(Zi): pass print(issubclass(Zi,Foo)) #True print(issubclass(Zi,Sun)) # False issubclass 2.type(对象) 返回该对象的数据类型,精确识别(即不向上兼容) class Animal: pass class Cat(Animal):…