1 Star 0 Fork 0

MaCong/Spider58

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
data_struct.py 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
mark 提交于 2017-12-29 10:14 . 爬取58保定二手房数据并分析
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
' contract module '
__author__ = 'Ma Cong'
import datetime
# 类
class info(object):
def __init__(self, title, mianshui, date, view_num, price, avg, shitingwei, cenggao,
area, zhuangxiu, toward, age, xiaoqu, weizhi, jingjiren, link):
'''
初始化数据结构
'''
self.title = self.excuteSting(title)
self.mianshui = self.excuteSting(mianshui)
self.date = self.excuteSting(date)
self.view_num = self.excuteSting(view_num)
self.price = self.excuteSting(price)
self.avg = self.excuteSting(avg)
self.shitingwei = self.excuteSting(shitingwei)
self.cenggao = self.excuteSting(cenggao)
self.area = self.excuteSting(area)
self.zhuangxiu = self.excuteSting(zhuangxiu)
self.toward = self.excuteSting(toward)
self.age = self.excuteSting(age)
self.xiaoqu = self.excuteSting(xiaoqu)
self.weizhi = self.excuteSting(weizhi)
self.jingjiren = self.excuteSting(jingjiren)
self.link = self.excuteSting(link)
self.shiqu = 0
def toSql(self):
return "'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'" % \
(self.title, self.mianshui, self.date, \
self.view_num, self.price, self.avg, self.shitingwei, \
self.cenggao, self.area, self.zhuangxiu, self.toward, self.age,\
self.xiaoqu, self.weizhi, self.jingjiren, self.link, self.shiqu)
def excuteSting(self, s):
if s is str:
return s.replace(',', '')
else:
return s
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/blueskymc/Spider58.git
[email protected]:blueskymc/Spider58.git
blueskymc
Spider58
Spider58
master

搜索帮助