摘要: 爬取目标:使用scrapy爬取所有课程数据,分别为 1.课程名 2.课程简介 3.课程等级 4.学习人数 并存入MySQL数据库 (目标网址 http://www.imooc.com/course/list) 一.导出数据文件到本地 1.新建imooc项目 1 scrapy startproject 阅读全文
posted @ 2017-08-03 11:31 1109159477 阅读(1228) 评论(0) 推荐(0) 编辑
摘要: 1 1.方法一 2 InputStream fis =TestProperties.class.getClassLoader().getResourceAsStream(“init.properties”) 3 4 2.方法二(要求TestProperties和init.properties在同一目录下) 5 InputStream fis =TestProperties.cla... 阅读全文
posted @ 2018-08-15 11:35 1109159477 阅读(1255) 评论(0) 推荐(0) 编辑
摘要: import random #对应从'0'到'9'的ASCII码 48~57 #对应从'A'到'Z'的ASCII码 65~90 #对应从'a'到'z'的ASCII码 97~122 def get_aZ(): num=random.randint(65,122) if num96: return chr(num) ... 阅读全文
posted @ 2018-04-03 17:20 1109159477 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 1 #-*- coding:utf-8 -*- 2 #根据第一列,统计和 3 4 ''' 5 cat info.txt 6 7 lisa,99 8 bart,80 9 lisa,100 10 bart,89 11 tom,87 12 13 ''' 14 15 d={} 16 with open('info.txt') as f: 17 for line in ... 阅读全文
posted @ 2017-12-08 17:30 1109159477 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 1 #-*- encoding= utf-8 -*- 2 from random import randint 3 import datetime 4 5 s=[] 6 7 for i in range(0,10000): 8 s.append(randint(1,10000)) 9 10 #排序算法 11 def sort_list(list): 12 ... 阅读全文
posted @ 2017-12-08 17:07 1109159477 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1 #! /usr/bin/env python 2 # -*- coding: utf-8 -*- 3 import MySQLdb 4 5 class Database: 6 def __init__(self,user,passwd,db,host,port): 7 self.user=user 8 self.pas... 阅读全文
posted @ 2017-12-07 22:34 1109159477 阅读(1006) 评论(0) 推荐(0) 编辑
摘要: 1 #coding:utf-8 2 from collections import OrderedDict 3 import datetime 4 dt=['20171001','20171001','20171002','20171003','20171005','20171006','20171006','20171008','20171009','20171010','201710... 阅读全文
posted @ 2017-10-20 16:25 1109159477 阅读(293) 评论(0) 推荐(0) 编辑
摘要: python 下载煎蛋无聊图 阅读全文
posted @ 2017-06-11 03:28 1109159477 阅读(889) 评论(0) 推荐(0) 编辑
摘要: #encoding:UTF-8 #Python 3.4.3 import urllib import requests ''' 天天快递 运单号码: 667612364334 圆通速递 运单号码: 885300598318625893 韵达快递 运单号码: 3839920843883 ''' kd=[['申通','shentong',0], ['EMS' ,'ems',... 阅读全文
posted @ 2017-06-06 11:30 1109159477 阅读(388) 评论(0) 推荐(0) 编辑
摘要: #encoding:UTF-8 #Python 3.4.3 import urllib import requests def get_info(): city=input('请输入要查询的城市名称:') url='http://gc.ditu.aliyun.com/geocoding?a='+urllib.parse.quote(city) weather_data =... 阅读全文
posted @ 2017-06-06 11:28 1109159477 阅读(614) 评论(0) 推荐(0) 编辑