按类别查询搜索结果
关于关键词 "Python" 的检测结果,共 437
【系统运维】 python-work实例8
chengxuyonghu | 2018-11-20 21:30:53 | 阅读(0) | 评论(0)
#!/usr/bin/env python#-*-coding:utf-8-*-import chardetimport MySQLdbimport os, sys, re,stringimport time, tarfile,getoptimport datetimeimport redisimport commandsimport urllibimport urllib2#src_redis = redis.StrictRedis(host='172.17.1.11', port=6379, db=0)os.system("rm -f /home/haore...【阅读全文】
【系统运维】 python实例work7
chengxuyonghu | 2018-11-20 12:31:23 | 阅读(0) | 评论(0)
#encoding=gbk#-*-coding:gbk-*- import sys#import MySQLdbimport mysql.connectorimport pandas as pdimport datetimeimport timeimport socketimport struct #查询登录IP def getip(uid):   config = { 'host':'17...【阅读全文】
chengxuyonghu | 2018-11-20 12:16:58 | 阅读(0) | 评论(0)
1. 字符串转列表str1 = "12345"list1 = list(str1)print list1 str2 = "123 sjhid dhi"list2 = str2.split() #or list2 = str2.split(" ")print list2 str3 = "www.google.com"list3 = str3.split(".")print list3 输出为: ['1', '2', '3', '4', '5']['123', 'sjhid', 'dhi']['www'...【阅读全文】
【系统运维】 python百分数小数
chengxuyonghu | 2018-11-14 15:03:19 | 阅读(0) | 评论(0)
#百分比转换位小数# -*- coding: utf-8 -*-s = '20%'  # 默认要转换的百分比是字符串aa = float(s.strip('%')) # 去掉s 字符串中的 %bb = aa/100.0  #运行环境是Python2.7   其中Python2.X  与 python 3X中的除法是有区别print bb# 输出结果是 0.2# 小数转换位百分比#方法一a = 0.32143...【阅读全文】
chengxuyonghu | 2018-11-12 21:02:25 | 阅读(0) | 评论(0)
def writeLog(txtname, contests):        f = file("/home/haoren/guojia/shanghai/%s" %txtname,'a+')        f.write(contests)        f.close()        returnalldata = []fd = open('/home/haoren/guojia/shanghai/shuju6....【阅读全文】
【系统运维】 python实例work5
chengxuyonghu | 2018-11-09 15:55:21 | 阅读(0) | 评论(0)
#%pyspark#包裹统计from pyspark.sql import Rowfrom pyspark.sql.types import *from pyspark.sql.functions import udfimport mysql.connectorimport datetimeimport timeimport pandas as pdimport numpy as npfrom fastparquet import ParquetFilefrom fastparquet import writeimport osdef fromDayTo...【阅读全文】
【系统运维】 python实例work6
chengxuyonghu | 2018-11-09 15:54:08 | 阅读(0) | 评论(0)
%pyspark#监控当天实时包裹import datetimeimport jsonfrom elasticsearch import Elasticsearchimport pandas as pdtoday = datetime.date.today().strftime("%Y-%m-%d")#print todayprint '截止'+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' 包裹数据'# 请求elasticsearch节点的urlurl =...【阅读全文】
【系统运维】 python实例work5
chengxuyonghu | 2018-11-09 15:51:58 | 阅读(0) | 评论(0)
%pyspark#监控当天实时包裹import datetimeimport jsonfrom elasticsearch import Elasticsearchimport pandas as pdtoday = datetime.date.today().strftime("%Y-%m-%d")#print todayprint '截止'+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' 包裹数据'# 请求elasticsearch节点的urlurl =...【阅读全文】
【系统运维】 python实例work5
chengxuyonghu | 2018-11-09 15:49:44 | 阅读(0) | 评论(0)
%pyspark#监控当天实时包裹import datetimeimport jsonfrom elasticsearch import Elasticsearchimport pandas as pdtoday = datetime.date.today().strftime("%Y-%m-%d")#print todayprint '截止'+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' 包裹数据'# 请求elasticsearch节点的urlurl =...【阅读全文】
【系统运维】 python操作elasticsearch
chengxuyonghu | 2018-11-02 16:50:55 | 阅读(10) | 评论(0)
from elasticsearch import Elasticsearchfrom elasticsearch_dsl import Search,Q,scanes = Elasticsearch()1、仿照kibana中的写法q = {"query": {"match": {"name": "easy"}}}res = es.Search(body=q)#这中方式返回的结果和kibana查询结果一致,为json2、通过elasticsearch_dsl的Search方法s = Search().usin...【阅读全文】
【系统运维】 python实例work3
chengxuyonghu | 2018-10-31 14:49:08 | 阅读(0) | 评论(0)
(1) %pyspark#监控当天购物车import datetimeimport jsonfrom elasticsearch import Elasticsearchimport pandas as pdtoday = datetime.date.today().strftime("%Y-%m-%d")#print todayprint '截止'+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' 购物车数据'# 请求elasticsearch节点的url...【阅读全文】
【系统运维】 python实例work4
chengxuyonghu | 2018-10-31 14:48:49 | 阅读(0) | 评论(0)
(3)%pyspark#查询认证消费者import sys#import MySQLdbimport mysql.connectorimport pandas as pdimport datetimeimport timeoptmap = {                'dbuser' : 'haoren',                'dbpass' : '123456',&n...【阅读全文】
【系统运维】 python实例work4
chengxuyonghu | 2018-10-31 14:48:03 | 阅读(0) | 评论(0)
(1)%pyspark#监控当天购物车import datetimeimport jsonfrom elasticsearch import Elasticsearchimport pandas as pdtoday = datetime.date.today().strftime("%Y-%m-%d")#print todayprint '截止'+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' 购物车数据'# 请求elasticsearch节点的urlu...【阅读全文】
【系统运维】 python实例work3
chengxuyonghu | 2018-10-31 14:47:26 | 阅读(0) | 评论(0)
(1) %pyspark#监控当天购物车import datetimeimport jsonfrom elasticsearch import Elasticsearchimport pandas as pdtoday = datetime.date.today().strftime("%Y-%m-%d")#print todayprint '截止'+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' 购物车数据'# 请求elasticsearch节点的url...【阅读全文】
【系统运维】 python实例work3
chengxuyonghu | 2018-10-31 14:47:10 | 阅读(0) | 评论(0)
(4)%pyspark#coding:utf-8#查询消费者手机号,名称import sys#import MySQLdbimport mysql.connectorimport pandas as pdimport datetimeimport timeoptmap = {                'dbuser' : 'haoren',                ...【阅读全文】
【系统运维】 python实例work3
chengxuyonghu | 2018-10-31 14:46:27 | 阅读(0) | 评论(0)
(1) %pyspark#监控当天购物车import datetimeimport jsonfrom elasticsearch import Elasticsearchimport pandas as pdtoday = datetime.date.today().strftime("%Y-%m-%d")#print todayprint '截止'+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' 购物车数据'# 请求elasticsearch节点的url...【阅读全文】
【系统运维】 python实例work2
chengxuyonghu | 2018-10-31 14:46:04 | 阅读(0) | 评论(0)
(7)%pyspark#区域签约用户信息  import sys#import MySQLdbimport mysql.connectorimport pandas as pdimport datetimeimport timeimport urllibimport urllib2optmap = {                'dbuser' : 'haoren',           ...【阅读全文】
【系统运维】 python实例work2
chengxuyonghu | 2018-10-31 14:45:03 | 阅读(0) | 评论(0)
(1)%pyspark#监控当天购物车import datetimeimport jsonfrom elasticsearch import Elasticsearchimport pandas as pdtoday = datetime.date.today().strftime("%Y-%m-%d")#print todayprint '截止'+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' 购物车数据'# 请求elasticsearch节点的urlu...【阅读全文】
【系统运维】 python实例work1
chengxuyonghu | 2018-10-31 14:44:30 | 阅读(0) | 评论(0)
(9)%pyspark#查询用户机器ID import sysimport MySQLdbimport pandas as pdimport datetimeoptmap = {                'dbuser' : 'haoren',                'dbpass' : '123456',        &nbs...【阅读全文】
【系统运维】 python实例work
chengxuyonghu | 2018-10-31 14:40:57 | 阅读(0) | 评论(0)
(1)%pyspark#监控当天购物车import datetimeimport jsonfrom elasticsearch import Elasticsearchimport pandas as pdtoday = datetime.date.today().strftime("%Y-%m-%d")#print todayprint '截止'+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ' 购物车数据'# 请求elasticsearch节点的urlu...【阅读全文】