上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: import requests from bs4 import BeautifulSoup import csv url = 'https://price.21food.cn/market/174-p1.html' headers = { 'User-Agent': 'Mozilla/5.0 (Wi 阅读全文
posted @ 2023-02-28 20:17 0x1e61 阅读(11) 评论(0) 推荐(0) 编辑
摘要: # 下面的一段HTML代码将作为例子被多次用到.这是 爱丽丝梦游仙境的 的一段内容(以后内容中简称为 爱丽丝 的文档): html_doc = """ <html><head><title>The Dormouse's story</title></head> <body> <p class="ti 阅读全文
posted @ 2023-02-28 20:16 0x1e61 阅读(9) 评论(0) 推荐(0) 编辑
摘要: import requests import re url = 'xxx/index2.htm' headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like 阅读全文
posted @ 2023-02-28 13:06 0x1e61 阅读(391) 评论(0) 推荐(0) 编辑
摘要: import csv import re import requests headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom 阅读全文
posted @ 2023-02-28 08:53 0x1e61 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 1. requests 中的请求方法 HTTP 请求方法: requests.get(url, params=None, **kwargs) # GET 请求 requests.post(url, data=None, json=None, **kwargs) # POST 请求 requests. 阅读全文
posted @ 2023-02-27 19:50 0x1e61 阅读(86) 评论(0) 推荐(0) 编辑
摘要: import re # 1.从一个字符串中提取到所以的数字 lst = re.findall('\d+', "fajhdsjk123kjfakl123213") print(lst) # 返回的是一个列表 # 2.判断一句话是否有数字 # search的特点:匹配字符串,匹配到第一个结果就返回,不会 阅读全文
posted @ 2023-02-26 23:12 0x1e61 阅读(23) 评论(0) 推荐(0) 编辑
摘要: import hashlib # 创建md5对象 obj = hashlib.md5() # 把要加密的信息传递给obj obj.update("6666".encode('utf-8')) # 从obj中拿到密文 mi = obj.hexdigest() print(mi) # e9510081a 阅读全文
posted @ 2023-02-26 22:28 0x1e61 阅读(10) 评论(0) 推荐(0) 编辑
摘要: import json # 准备列表,列表内每一个元素都是字典,将其转为JSON date = [{"name": "张大帅", "age": 11}, {"name": "王大锤", "age": 13}, {"name": "赵啸虎", "age": 16} ] # print(date) # 阅读全文
posted @ 2023-02-26 18:43 0x1e61 阅读(12) 评论(0) 推荐(0) 编辑
摘要: # callable() # 函数用于检查一个对象是否是可调用的。如果返回 True,object 仍然可能调用失败;但如果返回 False,调用对象 object 绝对不会成功。 # 对于函数、方法、lambda 函式、 类以及实现了 __call__ 方法的类实例, 它都返回 True。 pri 阅读全文
posted @ 2023-02-26 18:04 0x1e61 阅读(13) 评论(0) 推荐(0) 编辑
摘要: # 迭代器最大的作用就是统一了容器类型循环遍历的标准 for i in "你好": print(i) for i in 123: # int # 报错 :TypeError: 'int' object is not iterable # int 类型不可以迭代 print(i) print(dir( 阅读全文
posted @ 2023-02-26 15:43 0x1e61 阅读(12) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 下一页