摘要: #获取所有二手频道链接 import requests from bs4 import BeautifulSoup star_url = 'http://bj.ganji.com/wu/' url_host = 'http://bj.ganji.com' page_url = [] def get_index_url(url): wb_data = requests.get(url) ... 阅读全文
posted @ 2016-11-12 22:03 JessisLong 阅读(139) 评论(0) 推荐(0) 编辑
摘要: #就成功了一波,然后被封了。已经着手准备爬去豆瓣所有的电影titleandgradeimport requests from bs4 import BeautifulSoup import random headers = {'user_agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Ge... 阅读全文
posted @ 2016-11-09 18:05 JessisLong 阅读(186) 评论(0) 推荐(0) 编辑
摘要: #第一个模块 抓取所有频道链接 from bs4 import BeautifulSoup import requests start_url = 'http://bj.58.com/sale.shtml' url_host = 'http://bj.58.com' def get_index_url(url): wb_data = requests.get(url) so... 阅读全文
posted @ 2016-11-09 09:20 JessisLong 阅读(421) 评论(0) 推荐(0) 编辑
摘要: '''使用类和实例''' class Car(): """一次模拟汽车的简单尝试""" def __init__(self,make,model,year): """初始化描述汽车属性""" self.make = make self.model = model self.year = year ... 阅读全文
posted @ 2016-11-02 10:42 JessisLong 阅读(220) 评论(0) 推荐(0) 编辑
摘要: from bs4 import BeautifulSoupimport requestsimport timeurls = []def get_link_from(page_number): for each_number in range(1,page_number): list_view = 'http://bj.xiaozhu.com/search-duanzufang-... 阅读全文
posted @ 2016-10-28 15:32 JessisLong 阅读(239) 评论(0) 推荐(0) 编辑
摘要: class Dog(): #创建类 """一次模拟小狗的简单尝试""" def __init__(self,name,age): """初始化属性name和age""" self.name = name self.age = age def sit(self): ... 阅读全文
posted @ 2016-10-12 13:05 JessisLong 阅读(118) 评论(0) 推荐(0) 编辑
摘要: import smtplib import email from email.mime.text import MIMEText mail_host = "smtp.163.com" mail_to = ["2245312214@qq.com"] mail_user = "m18744115924@163.com" mail_pwd = "********" msg = MIMEText("哈... 阅读全文
posted @ 2016-10-10 10:08 JessisLong 阅读(96) 评论(0) 推荐(0) 编辑
摘要: magicians = ['alice','david','carolina'] #for循环操作 for magician in magicians: #不要遗漏冒号 print(magician) print( magician.title()+', that was a great trick') print(... 阅读全文
posted @ 2016-09-12 18:19 JessisLong 阅读(159) 评论(0) 推荐(0) 编辑
摘要: bicycles = ['trek','cannondale','redline','specialized'] #访问列表元素 print(bicycles) bicycles = ['trek','cannondale','redline','specialized'] print(bicycles[0]) bicycles = ['trek','cannondale','... 阅读全文
posted @ 2016-09-11 14:32 JessisLong 阅读(210) 评论(0) 推荐(0) 编辑
摘要: name = "ada lovelace" #单词首字母大写 print(name.title()) name = "Ada Lovelace" #全部大写,全部小写 print(name.upper()) print(name.lower()) first_name = "ada" #字符串的拼接 last_name = "lovelace" full_name = first_... 阅读全文
posted @ 2016-09-11 00:16 JessisLong 阅读(107) 评论(0) 推荐(0) 编辑