随笔分类 - python
开发工具
摘要:python在读取文件时出现“UnicodeDecodeError:'gbk' codec can't decode byte 0x89 in position 68: illegal multibyte sequence”错误 翻译为:“GBK”编解码器不能解码位置68中的字节0x89:非法多字节
阅读全文
摘要:首先是一张总结的图: 对各个不同的通信进行解分: 1、http通信详解 2、cookie通信图: 3、cookie管理的session信息 4、token通信
阅读全文
摘要:''' 根据字符串的形式去某个模块中寻找东西-->getattr() 根据字符串的形式去某个模块中判断东西是否存在-->hasattr() 根据字符串的形式去某个模块中设置东西-->setattr() 根据字符串的形式去某个模块中删除东西-->delattr() ''' # # 通过__import__导入目标模块 # f=__import__('login') # # 通过对象找login模...
阅读全文
摘要:'''模块与模块之间的调用''' import first #调用整个变量 print(first.Index) # #调用函数 print(first.hello()) # per = first.Index() per.hello() from first import * # per = Index() per.hello() # hello() #包与包之间的调用 fro...
阅读全文
摘要:''' 函数:是一段可以重复调用的代码,通过输入的参数,返回对应的结果 名字绑定的机制,把实际参数的值与形式参数的值绑定到一起 1、函数调用的时候,实际参数的值的顺序与形式参数的顺序一一对应 2、当在函数调用的时候,指定了形式参数的实际参数,这个时候并不是一一对应,而是根据指定的值进行的 ''' def add(a,b): c=a+b print(c) print(a, b) a...
阅读全文
摘要:一、注册 代码如下: 二、登陆 代码如下: 三、显示个人信息 代码如下: 四、主函数 代码如下: 五、执行
阅读全文
摘要:字符串、字典、元祖之间的相互转换: 1、字符串与列表之间的转换 结果: 2、列表与元祖之间的转换 结果: 3、字典与列表之间的转换 结果:
阅读全文
摘要:很久没有写了,现在正式入职,准备好好干,加油! 我的第一个较正式的测试代码:
阅读全文
摘要:转自: http://www.testclass.net/list/python_list_1/ xUnit frameworks(单元测试框架) frameworks 框架 unittest - python自带的单元测试库,开箱即用 unittest2 - 加强版的单元测试框架,适用于Pytho
阅读全文
摘要:import urllib.requestimport reimport osdef getHtml(url): page = urllib.request.urlopen(url) html = page.read() return htmldef getImg(html): imglist =
阅读全文
摘要:浅拷贝: A = [[1,2],3,4] B= A.copy() B[0][1] = 5 print(B,A) B = [[1,5],3,4] A = [[1,5],3,4] B[2]=6 A = [[1,2],3,4] B =[[1,2],3,6] 深拷贝: import copy A = [[1
阅读全文
摘要:# _Author:huang# date: 2017/11/28# 字符串'''print("hello" * 3)print("hello world"[2:])print("llo" in "hello world")print(123 in [1232,123,345])print("Hua
阅读全文
摘要:# _Author:huang# date: 2017/11/26# 简单的购物车程序money = input("money:")product_list = [ ("Mac", 9000), ("Kindle", 300), ("Tesla", 8000), ("book", 60), ("bi
阅读全文