摘要:1、读取文本文档 红球.txt 2、运行代码 with open('红球.txt', "r", encoding="utf-8")as f: d = {} for j in f: ls = j.split() for num in ls: d[num] = d.get(num, 0) + 1 for
阅读全文
posted @ 2020-12-30 14:35
随笔分类 - Python 相关问题
摘要:1、读取文本文档 红球.txt 2、运行代码 with open('红球.txt', "r", encoding="utf-8")as f: d = {} for j in f: ls = j.split() for num in ls: d[num] = d.get(num, 0) + 1 for
阅读全文
posted @ 2020-12-30 14:35
摘要:正则表达式爬取豆瓣电影TOP前250的中英文名 1、首先要实现网页的数据的爬取。新建test.py文件 test.py 1 import requests 2 3 def get_Html_text(url,p): 4 try: 5 h= {'User-Agent':'Mozilla/5.0 (Wi
阅读全文
posted @ 2020-12-22 17:13
|
||