按类别查询搜索结果
关于关键词 的检测结果,共 8683
chengxuyonghu | 2018-10-26 18:51:53 | 阅读(0) | 评论(0)
1.Elasticsearch模块的安装与引用:Python环境中,第一步需要安装相对应的elasticsearch模块,pip install elasticsearch,然后在文件中引用from elasticsearch import Elasticsearch2.Elasticsearch的连接obj = ElasticSearchClass("59.110.41.175", "9200", "", "")其中ElasticSearchClass里面是elasticsearch...【阅读全文】
cccc1777 | 2018-10-26 14:29:07 | 阅读(1570) | 评论(0)
python里面的全局变量小例子:http://www.512pic.com/181/1766-0.html【阅读全文】
【Python/Ruby】 学习Python的方法
萤火虫的秋 | 2018-10-26 11:45:07 | 阅读(750) | 评论(0)
为什么现在那么多的人开始学习Python,我们先来看看Python可以做什么?可以做日常任务,比如自动备份你的MP3;可以做网站,很多著名的网站像知乎、YouTube就是Python写的;可以做网络游戏的后台,很多在线游戏的后台都是Python开发的。等等……学习Python有两种方法,一种是线下面授班,一种在线...【阅读全文】
zds05 | 2018-10-26 11:29:21 | 阅读(0) | 评论(0)
2013年05月04日 08:32:36 liberize 阅读数:23078 标签: Python 相对导入 更多 个人分类: Python 1、绝对导入和相对导入绝对导入:按照sys.path顺序搜索,先主目录(sys.path中第一项''),然后PYTHONPATH环境变量、标准库路径、pth指定路径等。相对导入:在模块所在同一个包内...【阅读全文】
【系统运维】 python-work实例3
chengxuyonghu | 2018-10-24 17:09:18 | 阅读(0) | 评论(0)
#!/usr/bin/env python#-*-coding:utf-8-*-#会员数据统计import MySQLdbimport os, sys, re, stringimport time, getoptoptmap = {                'dbuser' : 'haoren',                'dbpass' : 'ss',     ...【阅读全文】
chengxuyonghu | 2018-10-23 11:33:58 | 阅读(0) | 评论(0)
# encoding: utf-8import sysreload(sys)sys.setdefaultencoding('utf-8')import timeimport pandas as pdimport xlsxwritertime1 = time.time()import numpy as np#############读取数据##########################df=pd.read_excel('C:/pic/sample.xlsx')# 建立每个顾客的购买记录# print df#########...【阅读全文】
【系统运维】 python-work实例2
chengxuyonghu | 2018-10-23 10:54:44 | 阅读(0) | 评论(0)
#历史充值查询import sys#import MySQLdbimport mysql.connectorimport pandas as pdimport datetimeimport timeimport urllibimport urllib2optmap = {                'dbuser' : 'haoren',                'dbpass' : ...【阅读全文】
chengxuyonghu | 2018-10-22 20:45:09 | 阅读(0) | 评论(0)
1. 计算字母和数字出现的次数 str='abc123abc456aa'd={}for x in str:    print x    if not x in d:        d[x]=1    else:        d[x]=d[x]+1 print d {'a': 4, 'c': 2, 'b': 2, '1': 1, '3': 1, '2': 1, '5': 1, ...【阅读全文】
【系统运维】 python-work实例
chengxuyonghu | 2018-10-18 15:31:22 | 阅读(0) | 评论(0)
cat xiaofei-paihang20181008-hedui.py#!/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='192.168.115.197', port=...【阅读全文】
chengxuyonghu | 2018-10-18 14:42:48 | 阅读(0) | 评论(0)
map()函数map()是 Python 内置的高阶函数,它接收一个函数 f 和一个 list,并通过把函数 f 依次作用在 list 的每个元素上,得到一个新的 list 并返回。例如,对于list [1, 2, 3, 4, 5, 6, 7, 8, 9]如果希望把list的每个元素都作平方,就可以用map()函数:因此,我们只需要传入函数f(x)=x*x,就可以利用map()函数完...【阅读全文】
chengxuyonghu | 2018-10-18 14:14:06 | 阅读(0) | 评论(0)
lambda基础lambda语句中,冒号前是参数,可以有多个,用逗号隔开,冒号右边的返回值。lambda语句构建的其实是一个函数对象,见证一下:>>> foo = [2, 18, 9, 22, 17, 24, 8, 12, 27]>>> print filter(lambda x: x % 3 == 0, foo)[18, 9, 24, 12, 27]>>> print map(lambda x: x * 2 + 10, foo)[14, 46, 28, 54, ...【阅读全文】
【Python/Ruby】 Python基础案例教程
梦共里醉 | 2018-10-17 11:40:47 | 阅读(1520) | 评论(0)
# 用户输入薯片的单价danjia = float(input("薯片的单价"))# 用户输入购买袋数daishu = int(input("购买的袋数"))# 计算总价zongjia = danjia * daishu# 输出结果print("薯片单价%.2f/袋,您购买了%d/袋,应付总价%.2f元。" % (danjia,daishu,zongjia))# %s是字符串格式化输出# %d是整数格式化输出# %f是浮点数(...【阅读全文】
master_kang | 2018-10-16 21:16:07 | 阅读(1060) | 评论(0)
python中支持:int、long、float、complex数据类型,int和long表示整数类型,只不过他们表示的范围不同,int比long表示的范围要小。float表示小数类型,我们一般称他为浮点型;complex表示复数类型。其中int类型又可以有好多种表示方法,十进制、二进制、八进制、十六进制。当给定我们一个数值时,我们可以使用print(typye(...【阅读全文】
master_kang | 2018-10-13 19:05:35 | 阅读(940) | 评论(0)
python中的注释方法和使用python2时中文打印的支持;【阅读全文】
zhufenjun2017 | 2018-10-12 18:35:48 | 阅读(1980) | 评论(0)
Python在国外应用相对成熟,在国内还处于起步阶段,近两年,随着人工智能、机器学习的、大数据以及云计算的兴起,Python发展势如破竹,很多企业开始进入该行列,Python人才是必不可少环节,然市场Python人才紧缺,因此,Python人才的就业形势和薪资待遇相比于同等资质的IT技术人员要好很多,因此,想转行做Python,现在就...【阅读全文】
chengxuyonghu | 2018-10-09 12:48:37 | 阅读(0) | 评论(0)
#!/usr/bin/env python# -*- coding: utf-8 -*-import datetimeimport calendartime = datetime.date(2017, 7, 20) #年,月,日#求该月第一天first_day = datetime.date(time.year, time.month, 1)print u'该月第一天:' + str(first_day)#求前一个月的第一天#前一个月最后一天pre_month = first_day ...【阅读全文】
cccc1777 | 2018-10-08 09:05:04 | 阅读(1610) | 评论(0)
Python re正则匹配中文,其实非常简单,把中文的unicode字符串转换成utf-8格式就可以了,然后可以在re中随意调用将输入的utf-8中文解密为unicode,然后交由python处理 摘自:http://www.512pic.com/181/2141-0.html【阅读全文】
【Python/Ruby】 python抓取https
wwm | 2018-10-03 15:35:35 | 阅读(2250) | 评论(0)
#-*- coding:utf-8 -*-import urllibimport urllib2# 1. 导入Python SSL处理模块import sslimport timeimport sysimport random import codecsfrom bs4 import BeautifulSoupreload(sys)  sys.setdefaultencoding('utf8')  def  getUrl(url):   # 1. 表示忽略未经...【阅读全文】
【Python/Ruby】 python常见问题汇总
wwm | 2018-10-03 15:01:53 | 阅读(1200) | 评论(0)
1、nohup 重定向时候,print 输出不能定向到文件解决办法:加-uYou can run Python with the -u flag to avoid output bufferingnohup python -u  fetch.py  >error.txt 2>&1 &【阅读全文】
wwm | 2018-10-02 19:29:22 | 阅读(1100) | 评论(0)
转自:https://www.cnblogs.com/ajgwusai/p/8249941.html不论你是有着多年经验的 Python 老司机还是刚入门 Python 不久,你一定遇到过UnicodeEncodeError、UnicodeDecodeError 错误,每当遇到错误我们就拿着 encode、decode 函数翻来覆去的转换,有时试着试着问题就解决了,有时候怎么试都没辙,只有借用 Google 大神帮...【阅读全文】