![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
wyl9527
将平时的工作进行一下总结。。。。
展开
-
python3 读取excel表中的数据并插入到数据库中
#!/usr/bin/python # -*- coding: utf-8 -*- import pymysql import pandas as pd import sys def get_assets(): assets = pd.read_excel(sys.argv[1]) ip = assets ['IP'].astype('str') price = assets ['金额'].astype('str') ip_price_dict = dict(zip(i.原创 2020-06-05 10:37:07 · 1119 阅读 · 1 评论 -
python 编写的DHT Crawler 网络爬虫
1、安装boost依赖和编译环境。 yum install -y boost boost-devel yum install -y make gcc gcc-c++ kernel-devel python-devel 2、装 libtorrent 的 python 绑定库 #下载到本地 cd /opt/software wget https://github.com/arvidn/...原创 2018-09-01 18:39:06 · 747 阅读 · 1 评论 -
python爬虫图片
1、爬取图片的脚本如下: from bs4 import BeautifulSoup import requests URL = "https://www.aitaotu.com/mxtp/dlmx/22933.html" html = requests.get(URL).text soup = BeautifulSoup(html, 'lxml') img_url = soup.fin...原创 2018-07-28 22:30:47 · 1455 阅读 · 3 评论 -
python random模块
1、python标准库中的random模块重要方法: random() 返回0<=n<1之间的随机实数n; choice(seq) 从序列seq中返回随机的元素; shuffle(seq[, random]) 原地指定seq序列; sample(seq, n) 从序列seq中选择n个随机且独立的元素; 2、random方法: print(random.random()) ...原创 2018-07-28 18:30:44 · 158 阅读 · 0 评论 -
python练习模仿购物车功能
#!/usr/bin/python #coding=utf-8shopping_mail=[ ('iphone',5888), ('apple',18), ('coffee',30), ('pencel',20), ('car',150000), ('bike',900), ] salary=input("请输入你的薪水:") if salary.isdigit(): salary=int(原创 2017-12-01 02:09:21 · 669 阅读 · 0 评论 -
python生成验证码
#!/usr/bin/python #coding=utf-8#引入模块 import random temp='' count=0 #循环6次,每次生成一个字符 for i in range(6): #这里的随机数和下面进行对比,如果对比成功则生成一个数字,这样数字就是随机出现。 r=random.randrange(1, 6) if r==2 or r==4:原创 2017-12-01 01:25:53 · 270 阅读 · 0 评论 -
python的登录验证练习
#!/usr/bin/python #coding=utf-8 #Author=wyl def register(): uname = input("请注册用户:") passwd = input("请输入密码:") f = open("db",'a') temp = "\n"+uname+","+passwd f.write(temp) f.clos原创 2017-10-17 01:57:50 · 308 阅读 · 0 评论