随笔分类 - Python实例
摘要:import turtle pen = turtle.Pen() pen.speed(10) width = 30 # 格子宽度 count = 18 # 横向纵向格子数 o = width * count / 2 # 开始绘制原点 for i in range(count + 1): pen.penup() pen.goto(-o, o - i * width) ...
阅读全文
摘要:import time def progress(percent, width=50): ''' 进度打印功能 :param percent: 进度 :param width: 进度条长度 ''' if percent >= 100: percent = 100 show_str = ('[%%-%ds]' % wid...
阅读全文
摘要:import requests from bs4 import BeautifulSoup def parse_html(num): headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0...
阅读全文
摘要:from hashlib import md5 def encrypt_md5(s): # 创建md5对象 new_md5 = md5() # 这里必须用encode()函数对字符串进行编码,不然会报 TypeError: Unicode-objects must be encoded before
阅读全文

浙公网安备 33010602011771号