摘要: # conding:utf-8 import requests from lxml import etree import re import urllib3 urllib3.disable_warnings() s = requests.session() def get_it_execution 阅读全文
posted @ 2020-11-12 17:25 天天眠眠 阅读(189) 评论(0) 推荐(0) 编辑
摘要: # conding:utf-8 import requests from lxml import etree #爬取网页的功能模块 import urllib3 urllib3.disable_warnings() s = requests.session() def get_it_executio 阅读全文
posted @ 2020-11-12 16:22 天天眠眠 阅读(1822) 评论(0) 推荐(0) 编辑
摘要: import time time.sleep() sleep()顾明思义就是睡觉的意思,就是脚本一旦执行到条语句sleep(10)就睡10s,再执行后面的语句,他是一个强制等待的方式,使得整个脚本暂停。但是这种方式会导致这个脚本运行时间过长,不到万不得已尽可能少用,特殊情况下,时间设置最好不超过1秒 阅读全文
posted @ 2020-11-09 17:03 天天眠眠 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 1、绝对路径和相对路径 Linux中使用 . 来表示当前目录,使用 .. 来表示上一级目录。 - 表示上次所在目录,~ 表示当前用户的“home”目录。使用命令pwd可以获得当前所在路径,注意是绝对路径。 绝对路径就是以根“/”目录为起点,以你所到达的目录为终点,表现形式为/usr/local/bi 阅读全文
posted @ 2020-11-09 11:53 天天眠眠 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 字符串 "axbyczdj",如果得到结果“abcd” str1 = "axbyczdj" list1 = [] for i in range(len(str1)): if i%2 == 0: list1.append(str1[i]) print(''.join(list1)) 也可以用比较新潮的 阅读全文
posted @ 2020-11-05 15:46 天天眠眠 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 创建数据表 drop table if exists students; create table students ( studentNo varchar(10) primary key, name varchar(10), sex varchar(1), hometown varchar(20) 阅读全文
posted @ 2020-11-05 14:51 天天眠眠 阅读(87) 评论(0) 推荐(0) 编辑
摘要: mysql -u root -p 输入密码后可通过命令行操作数据库show databases; 显示数据库use test; 使用哪一个数据库 set charset gbk; 设置中文,避免中文乱码 select * from jiba; 查询数据表insert into test.create 阅读全文
posted @ 2020-11-05 14:40 天天眠眠 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 废话不说,上干 import pymysql #pip install pymysql dbinfo = { "host": "192.168.1.105", "user": "root", "password": "你的数据库密码", "port": 3306} class DbConnect: 阅读全文
posted @ 2020-11-05 14:35 天天眠眠 阅读(582) 评论(0) 推荐(0) 编辑
摘要: 封装几个常用的类 configEmail.py import os import smtplib import base64 from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart cla 阅读全文
posted @ 2020-11-03 15:07 天天眠眠 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 每个接口用一个单独的测试文件 test01case.py import os import sys sys.path.append(os.getcwd()) import unittest from common.configHttp import RunMain import paramunitt 阅读全文
posted @ 2020-11-03 15:02 天天眠眠 阅读(124) 评论(0) 推荐(0) 编辑