
python
文章平均质量分 57
echodouble
pick me up
展开
-
python读取txt数据,转换到excel表中
接收后台模拟数据,存放在txt文件中,需要转换到excel中txt中的数据格式为: recv message - 82815: {"export1": 0, "export0": 0, "export3": 1, "export2": 0, "export5": 0, "export4": 0, "clean1_5": 0, "clean1_4": 2, "clean1_1": 0转载 2016-12-30 10:31:53 · 5904 阅读 · 0 评论 -
python--从hbase查询数据
import pandas as pddevice_id = ***start_time = time_utils.string_to_timestamp("2018-06-29_04-00-00") * 1000end_time = time_utils.string_to_timestamp("2018-06-29_07-00-00") * 1000hbase = hbase_util...原创 2018-07-06 11:30:58 · 3795 阅读 · 1 评论 -
python--selenium与自动化购物流程
#coding=utf-8'''登录smzdm.com,并签到'''from selenium import webdriverfrom seleniuim.webdriver.support.ui import WebDriverWait as Waitfrom selenium.common.exceptions import NoSuchAttributeException,\ NoS...转载 2018-03-07 15:36:24 · 1540 阅读 · 0 评论 -
python--爬虫百度天气数据
#coding=utf-8'''从百度或者http://www.weather.com.cn获取天气情况'''from selenium import webdriverimport timeclass BaiduWeather(): def __init__(self): self.query_url = 'http://www.baidu.com/s?wd=%stianqi...转载 2018-03-07 15:39:37 · 882 阅读 · 0 评论 -
python--爬虫微博热门数据
#coding=utf-8'''从weibo.com中获取前20条热门话题'''from selenium import webdriverfrom selenium.webdriver.support.ui import WebDriverWait as Waitimport unittestimport time import sysreload(sys)sys.setdefaultenco...转载 2018-03-07 15:41:54 · 652 阅读 · 0 评论 -
python--爬虫知乎热门数据
#coding=utf-8'''从zhihu.com中获取每日最热和每月最热'''from selenium import webdriverfrom datatime import dateimport timeimport sysreload(sys)sys.setdefaultencoding("utf8")class Zhihu(): def __init__(self): ...转载 2018-03-07 15:44:54 · 1137 阅读 · 0 评论 -
python--正则表达式过滤数据
import reimport csvimport jsonCONFIG_HEADER = ["ChangeSrc", "timestamp", "power", "bright", "ct", "device_id"]RUN_HEADER = ["ChangeSrc", "timestamp", "ManualAD", &quo原创 2018-03-07 15:50:53 · 1381 阅读 · 0 评论 -
python--mqtt后台消息的接收与转发
# coding=utf-8#接收数据代码模块import paho.mqtt.client as mqttimport jsondef on_message(client, userdata, msg,user_id = 11029): data = str(msg.payload) jsonDict = json.loads(data) if(jsonDict is not ...原创 2018-03-07 16:04:47 · 8538 阅读 · 0 评论 -
python--数据写入csv
# -*- coding: utf-8 -*-import sysimport globa_dataimport csvreload(sys)sys.setdefaultencoding('utf8')# 读取要解析的文件def data_process(path1): all_data = [] with open(path1, 'r') as f: lines = f...原创 2018-03-07 16:11:49 · 2347 阅读 · 0 评论 -
python与excel:数组写入到excel
import openpyxlfrom openpyxl.workbook import Workbookimport datetimeoutwb = Workbook()wo = outwb.activecareerSheet = outwb.create_sheet('career',0)# careerSheet['A1']= datetime.datetime.now()...转载 2018-05-23 10:55:34 · 17846 阅读 · 0 评论 -
python--配置数据读取csv文件数据
def sleep_csv_post(filepath): df = pd.read_csv(filepath) for i, row in df.iterrows(): current_status_time = get_time(row["current_status_time"]) message = { "status": ro...原创 2018-07-03 14:01:36 · 500 阅读 · 0 评论