摘要:        
上周回顾 异常处理 try xxx except IndexError as e: print() except Exception as e: print() else: print('没有出现异常!') finally: pass 面向对象 类 模型 实例 根据这个模型造出来的东西 实例化 造东    阅读全文
        
            posted @ 2018-03-07 15:24
王思磊
阅读(142)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
import threadingimport timedef pz(): time.sleep(2) print('A是秦始皇的陪葬')for i in range(10): t = threading.Thread(target=pz) # 设置子线程为守护线程,守护线程就是一旦主线程执行结束,子    阅读全文
        
            posted @ 2018-03-07 15:20
王思磊
阅读(146)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
import threading# 如果多线程想获取到结果的话,那么就得把它的结果写到一个list里面res = []def lida(x, y): res.append(x + y)for i in range(5): t = threading.Thread(target=lida, args=    阅读全文
        
            posted @ 2018-03-07 15:19
王思磊
阅读(228)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
# 想利用多核cpu,那么就使用多进程import multiprocessingimport timeimport threadingdef run2(): print('这是多线程启动的')def run(): time.sleep(2) print('多进程') for j in range(    阅读全文
        
            posted @ 2018-03-07 15:19
王思磊
阅读(100)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
import threadingimport timeimport requestsdef say_hi(name): time.sleep(2) print(name)def down_html(url1, name): res = requests.get(url1).content with     阅读全文
        
            posted @ 2018-03-07 15:16
王思磊
阅读(120)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
import unittest# import HTMLTestRunner # 难看的测试报告from BeautifulReport import BeautifulReport # 漂亮的测试报告''' assertEqual(a, b) a == b assertNotEqual(a, b)    阅读全文
        
            posted @ 2018-03-07 15:13
王思磊
阅读(138)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
# mysqldump -uroot -p123456 -A > nhy123.sqlimport osimport datetimeclass BakDb(object): def __init__(self, ip, username, password, port=3306, path='/t    阅读全文
        
            posted @ 2018-03-07 15:09
王思磊
阅读(282)
评论(0)
推荐(0)
        
        
            
        
        
摘要:        
class Coon(object): def __init__(self, host, password, port): self.host = host self.password = password self.port = port class CoonMysql(Coon): def __    阅读全文
        
            posted @ 2018-03-07 14:48
王思磊
阅读(587)
评论(0)
推荐(0)
        
        
 
                    
                     
                    
                 
                    
                 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号