上一页 1 ··· 5 6 7 8 9 10 下一页
该文被密码保护。 阅读全文
posted @ 2020-09-10 00:05 短戈行 阅读(3) 评论(0) 推荐(0) 编辑
摘要: import datetime nowtime=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') print(nowtime) 阅读全文
posted @ 2020-09-08 02:39 短戈行 阅读(172) 评论(0) 推荐(0) 编辑
摘要: #九九乘法表1 for a in range(1,10): for b in range(1,a+1): print("%s*%s=%s"%(a,b,a*b),end="\t") print() #九九乘法表2 for a in range(1,10): for b in range(1,10): 阅读全文
posted @ 2020-09-05 22:47 短戈行 阅读(3401) 评论(0) 推荐(0) 编辑
摘要: 1.基础请求框架 from urllib import request url=r"http://www.baidu.com" req=request.Request(url) #构造请求 response=request.urlopen(req).read().decode() #获取响应 pri 阅读全文
posted @ 2020-09-05 16:15 短戈行 阅读(3448) 评论(0) 推荐(0) 编辑
摘要: File - Settings - Editor - File and Code Templates #-*- codeing = utf-8 -*- #@Time: ${DATE} ${TIME} #@Author: Wayne #@File: ${NAME}.py #@Software: ${P 阅读全文
posted @ 2020-09-05 14:51 短戈行 阅读(286) 评论(0) 推荐(0) 编辑
摘要: from bs4 import BeautifulSoup #网页解析,获取数据 import re #正则表达式,进行文字匹配 import urllib.request,urllib.error #制定URL,获取网页数据 import sqlite3 #进行SQLite数据库操作 def ma 阅读全文
posted @ 2020-09-03 19:29 短戈行 阅读(316) 评论(0) 推荐(0) 编辑
摘要: from bs4 import BeautifulSoup #网页解析,获取数据 import re #正则表达式,进行文字匹配 import urllib.request,urllib.error #制定URL,获取网页数据 import xlwt #进行excel操作 def main(): b 阅读全文
posted @ 2020-09-03 18:38 短戈行 阅读(294) 评论(0) 推荐(0) 编辑
摘要: # 1.连接数据库 conn = sqlite3.connect("test.db") #打开或创建数据库文件 print("Opened database successfully") # 2.创建数据表 conn = sqlite3.connect("test.db") #打开或创建数据库文件 阅读全文
posted @ 2020-09-03 18:34 短戈行 阅读(2162) 评论(0) 推荐(0) 编辑
摘要: # 删除爬取字符串中的特殊字符 def SubPunctuation(str): s = re.sub(u"[+——!,。?、~@#¥%……&*()::¶]+", u"",str) return s 阅读全文
posted @ 2020-09-02 16:04 短戈行 阅读(535) 评论(0) 推荐(0) 编辑
摘要: \xa0表示不间断空白符,爬虫中遇到它的概率不可谓不小,而经常和它一同出现的还有\u3000、\u2800、\t等Unicode字符串。单从对\xa0、\t、\u3000等含空白字符的处理来说,有以下几种方法可行: 使用re.sub 使用正则表达式可以轻松匹配所有空白字符,它对于Unicode字符也 阅读全文
posted @ 2020-09-02 15:45 短戈行 阅读(1566) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 下一页