随笔分类 -  python3.6笔记

摘要:import socketserverclass MySocket(socketserver.StreamRequestHandler): def handle(self): conn = self.request add = self.client_address while True: acce 阅读全文
posted @ 2018-06-06 23:03 糖宝虫 阅读(142) 评论(0) 推荐(0)
摘要:python3.6 子类的__init__调用父类的__init__ 父类 子类 输出: C:\Users\lys-tbc\AppData\Local\Programs\Python\Python36\python.exe D:/pythonwakce/mysqltest/test/test03-i 阅读全文
posted @ 2018-02-06 22:42 糖宝虫 阅读(333) 评论(0) 推荐(0)
摘要:python3.6从含有html代码的json的中取出某个值 之前在做接口测试的时候,网站的后端是用java写的,然后接口的response返回的都是json格式,json很简单,就是字典,类似这样子的。 后面跳槽到了另外一家公司,网站是用php写的,接口返回的response格式也是json,不过 阅读全文
posted @ 2018-02-06 22:02 糖宝虫 阅读(1424) 评论(0) 推荐(0)
摘要:python3 杂记 test001 --test001.py ( ) test002 --test002.py ( ) test003 --test003.py ( ) 最后执行 test003.py输出 : 321 为什么test003.py没有导入test002,怎么会打印出2呢,因为在tes 阅读全文
posted @ 2017-10-23 18:08 糖宝虫 阅读(140) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2017-10-23 18:00 糖宝虫
摘要:#rjust(12,'l')"12是字符串的长度,l是当字符串不够长的时候,用l填充。并且字符串右对齐"。返回一个原字符串右对齐,并使用空格填充至长度 width 的新字符串。如果指定的长度小于字符串的长度则返回原字符串l=["123","1252454","894651245"]for i in 阅读全文
posted @ 2017-09-07 23:04 糖宝虫 阅读(371) 评论(0) 推荐(0)
摘要:a=[1,2,3,4]print(repr(a))print(type(repr(a)))for i in repr(a): print(i)#repr函数是将对象转换成string类型 阅读全文
posted @ 2017-09-07 20:16 糖宝虫 阅读(333) 评论(0) 推荐(0)
摘要:import randoma=[]for i in range(9): b=random.randint(0,9)#生产9个随机数 a.append(b)#把生成的随机数添加到列表里面print(sorted(a))#对列表进行排序 阅读全文
posted @ 2017-09-07 17:02 糖宝虫 阅读(143) 评论(0) 推荐(0)
摘要:需要逆向循环序列的话,先正向定位序列,然后调用 reversed() 函数。 for i in reversed(range(1, 10, 2)): print(i)97531 阅读全文
posted @ 2017-09-07 15:21 糖宝虫 阅读(205) 评论(0) 推荐(0)
摘要:a=[1,2,3]b=[4,5,6]for A ,B in zip(a,b):#用zip()函数整体打包 print(A,B) 阅读全文
posted @ 2017-09-07 15:19 糖宝虫 阅读(115) 评论(0) 推荐(0)
摘要:d={"A":"a","B":"b","C":"c","D":"d"}c=d.items()#字典(Dictionary) items() 函数以列表返回可遍历的(键, 值) 元组数组。for a,b in c: print(a,b)b=enumerate(c)#对于一个可迭代的(iterable) 阅读全文
posted @ 2017-09-07 14:55 糖宝虫 阅读(184) 评论(0) 推荐(0)
摘要:for i in range(10): if i==5: continue #跳出当次循环 if i==8: break #跳出整个for循环 print(i) 阅读全文
posted @ 2017-08-31 20:45 糖宝虫 阅读(140) 评论(0) 推荐(0)
只有注册用户登录后才能阅读该文。
posted @ 2017-08-22 23:35 糖宝虫 阅读(1) 评论(0) 推荐(0)
只有注册用户登录后才能阅读该文。
posted @ 2017-08-20 23:19 糖宝虫 阅读(1) 评论(0) 推荐(0)
只有注册用户登录后才能阅读该文。
posted @ 2017-08-08 00:12 糖宝虫 阅读(5) 评论(0) 推荐(0)
摘要:name:lysother1other2other3e:10000c:sexd:Japan 这里还有一个关于赋值的问题: 阅读全文
posted @ 2017-08-07 00:11 糖宝虫 阅读(165) 评论(0) 推荐(0)
摘要:#生成器def MyDemo(M): for i in range(M): yield i**2for item in MyDemo(9): print(item)# #生成器import sysa=(i**2 for i in range(5))while True: try: print(nex 阅读全文
posted @ 2017-08-03 21:26 糖宝虫 阅读(124) 评论(0) 推荐(0)
摘要:#迭代器import syslist=[1,2,3,4]it=iter(list)while True: try: print(next(it)) except StopIteration: sys.exit() #迭代器it=iter(list)print(next(it))print(next( 阅读全文
posted @ 2017-08-03 19:43 糖宝虫 阅读(102) 评论(0) 推荐(0)
摘要:import threadingimport time#继承 class threading.Threadclass MyThread(threading.Thread): #类做初始化 def __init__(self,name): #调用hreading.Thread.__init__(sel 阅读全文
posted @ 2017-08-01 21:13 糖宝虫 阅读(135) 评论(0) 推荐(0)