摘要: import random import string ''' ascii_letters是生成所有字母,从a-z和A-Z,digits是生成所有数字0-9.s ''' def rand_str ( num , length = 7 ) : f = open ( 'Activation_code.t 阅读全文
posted @ 2021-07-03 15:04 索匣 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 打开数据库连接 与数据库进行连接需要在pymysql.connect()函数中传入参数数据库地址(本机就写localhost),还有用户名user,密码password,数据库名db; 返回的是数据的游标,游标可以对数据进行读取,添加,删除等操作 import pymysql # pymysql.c 阅读全文
posted @ 2021-07-03 15:03 索匣 阅读(172) 评论(0) 推荐(0) 编辑
摘要: post登录需要传递的是data参数,他是写入到body里面的,而get请求中的params是在url上添加参数 # coding:utf-8 import requests # 登录请求地址需要自己抓包 url = 'https://accounts.douban.com/j/mobile/log 阅读全文
posted @ 2021-07-03 11:24 索匣 阅读(406) 评论(0) 推荐(0) 编辑
摘要: # from datetime import datetime # nextdate=datetime.strptime("2019-04-01 12:12:12","%Y-%m-%d %H:%M:%S") # %Y年%m月%d日%h时%M分%s秒 # strftime 是日期转字符串 # 想字符串 阅读全文
posted @ 2021-07-03 11:21 索匣 阅读(29) 评论(1) 推荐(0) 编辑
摘要: # def division(a, b): # # write your code here # try: # c = int((a + b)/(a - b)) # return('a={0},b={1},(a + b)/(a - b)={2}'.format(a,b,c)) # except Ze 阅读全文
posted @ 2021-07-03 11:17 索匣 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 1、去空格及特殊符号 strip: 用来去除头尾字符、空白符(包括\n、\r、\t、' ',即:换行、回车、制表符、空格) lstrip:用来去除开头字符、空白符(包括\n、\r、\t、' ',即:换行、回车、制表符、空格) rstrip:用来去除结尾字符、空白符(包括\n、\r、\t、' ',即: 阅读全文
posted @ 2021-07-02 20:58 索匣 阅读(258) 评论(1) 推荐(0) 编辑
摘要: 之后找到缘由的解决办法https://www.cnblogs.com/wkhzwmr/p/15230518.html import requests from bs4 import BeautifulSoup if __name__ == '__main__': #对首页的页面数据进行爬取 head 阅读全文
posted @ 2021-07-01 20:01 索匣 阅读(626) 评论(0) 推荐(0) 编辑
摘要: markdown模式下添加url有可能也会被认为是页面链接,浏览器就把他渲染出来 这时候可复制过啦改为tinymce模式编写,这样就不会报错了 阅读全文
posted @ 2021-07-01 17:35 索匣 阅读(1370) 评论(0) 推荐(0) 编辑
摘要: import osimport reimport requestsif not os.path.exists('./qiutuLibs'): os.mkdir('./qiutuLibs') url = 'https://www.qiushibaike.com/imgrank/' # '//www.q 阅读全文
posted @ 2021-06-30 21:52 索匣 阅读(29) 评论(0) 推荐(0) 编辑
摘要: import random from re import A """ 用户身份验证 version: 0.1 Author: jhk """ # uesname = input('请输入用户名:') # password = input('请输入口令:') # # 用户名是admin且密码是1234 阅读全文
posted @ 2021-06-28 21:34 索匣 阅读(47) 评论(0) 推荐(0) 编辑