
python
xiaoxiaoqunqun
github:https://github.com/happydayhappyday
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
使用 PyMySQL 连接数据库,并实现简单的增删改查
首先需要 import pymysql 1.连接数据库 #获取数据库连接 def getDBConn(): conn = pymysql.connect( host = 'localhost', port = 3306, user = 'root', password = '123', db = 'insurancedata', charset = 'utf8'...原创 2018-11-21 09:50:50 · 694 阅读 · 0 评论 -
scrapy使用
1.建立工程和Spider模板 scrapy startproject BaiduStocks cd BaiduStocks scrapy genspider stocks baidu.com 2.运行爬虫 scrapy crawl stocks原创 2018-11-21 09:56:28 · 199 阅读 · 0 评论 -
pip install scrapy报错
环境:python3.6.3 error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools ---------------------...原创 2018-11-17 17:17:32 · 220 阅读 · 0 评论 -
python3 对目录下的所有pdf文件重新命名
#!/usr/bin/env python # encoding: utf-8 import os def rename(dirname): filelist = os.listdir(dirname) count = 0 for file in filelist: olddir = os.path.join(dirname,file) if os.path.isdir(oldd...原创 2018-11-26 20:03:02 · 2185 阅读 · 0 评论 -
Python 下载网络文件
# -*- coding: utf-8 -*- import requests import csv #下载文件 def downloadfiles(url,count): f = requests.get(url) filename = str(count)+".pdf" with open(filename,"wb") as code: code.write(f.content) ...原创 2018-11-30 10:15:19 · 1880 阅读 · 0 评论 -
python 从url中提取文件名
import os url = 'http://www.**.net/images/logo.gif' filename = os.path.basename(url) print(filename)转载 2018-12-03 09:57:54 · 2735 阅读 · 1 评论 -
python 根据文件名删除文件
# -*- coding: utf-8 -*- import os def delete_file(dirname): filelist = os.listdir(dirname) for file in filelist: oldpath = os.path.join(dirname,file) filename = os.path.splitext(file)[0]#文件名 ...原创 2018-12-08 13:18:40 · 2752 阅读 · 0 评论