摘要:
#获取所有二手频道链接 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) ... 阅读全文
摘要:
#就成功了一波,然后被封了。已经着手准备爬去豆瓣所有的电影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... 阅读全文
摘要:
#第一个模块 抓取所有频道链接 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... 阅读全文
摘要:
'''使用类和实例''' class Car(): """一次模拟汽车的简单尝试""" def __init__(self,make,model,year): """初始化描述汽车属性""" self.make = make self.model = model self.year = year ... 阅读全文
摘要:
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-... 阅读全文
摘要:
class Dog(): #创建类 """一次模拟小狗的简单尝试""" def __init__(self,name,age): """初始化属性name和age""" self.name = name self.age = age def sit(self): ... 阅读全文
摘要:
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("哈... 阅读全文
摘要:
magicians = ['alice','david','carolina'] #for循环操作 for magician in magicians: #不要遗漏冒号 print(magician) print( magician.title()+', that was a great trick') print(... 阅读全文
摘要:
bicycles = ['trek','cannondale','redline','specialized'] #访问列表元素 print(bicycles) bicycles = ['trek','cannondale','redline','specialized'] print(bicycles[0]) bicycles = ['trek','cannondale','... 阅读全文
摘要:
name = "ada lovelace" #单词首字母大写 print(name.title()) name = "Ada Lovelace" #全部大写,全部小写 print(name.upper()) print(name.lower()) first_name = "ada" #字符串的拼接 last_name = "lovelace" full_name = first_... 阅读全文