随笔分类 -  Python

摘要:进制转换 bin(10) # 转二进制 oct(100) # 转八进制 int(10) # 转十进制 hex(255) # 转十六进制 chr(97) # 转字符串。chr(97) 返回字符串 'a' ord("a") # 转整数。ord('a') 返回整数 97 四舍五入 round(3.1414 阅读全文
posted @ 2021-05-25 15:14 忆秋年枫叶情 阅读(42) 评论(0) 推荐(0)
摘要:示例 try: pass except (Exception, OverflowError, AttributeError): #捕获多个异常 print("发生了异常执行") pass else: print("没发生异执行") pass finally: print("finally") pas 阅读全文
posted @ 2021-05-09 11:33 忆秋年枫叶情 阅读(78) 评论(0) 推荐(0)
摘要:import time # 当地时间 time.localtime() # (tm_year=2021, tm_mon=5, tm_mday=3, tm_hour=19, tm_min=50, tm_sec=40, tm_wday=0, tm_yday=123, tm_isdst=0) time.s 阅读全文
posted @ 2021-05-09 11:30 忆秋年枫叶情 阅读(745) 评论(0) 推荐(0)
摘要:文档: https://www.pycryptodome.org/en/latest/ # pip install pycryptodome from Crypto.Cipher import AES import base64 class Encrypt: def __init__(self, k 阅读全文
posted @ 2021-05-09 11:29 忆秋年枫叶情 阅读(547) 评论(0) 推荐(0)
摘要:import asyncio import time async def say_after(delay, what): """使用 async 声明函数""" await asyncio.sleep(delay) print(what) async def main(): # 一个一个执行 pri 阅读全文
posted @ 2021-05-09 11:27 忆秋年枫叶情 阅读(54) 评论(0) 推荐(0)
摘要:示例 # pip install aiohttp import asyncio import aiohttp headers = { "Referer": "https://vod.bunediy.com", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; 阅读全文
posted @ 2021-05-09 11:24 忆秋年枫叶情 阅读(212) 评论(0) 推荐(0)