按类别查询搜索结果
关于关键词 的检测结果,共 346
chengxuyonghu | 2017-02-27 14:49:58 | 阅读(1160) | 评论(0)
#!/usr/bin/env python#coding:utf-8import xlrdimport MySQLdbimport datetime  xlsfile=r'C:\Users\XUWU\Desktop\data.xlsx'book = xlrd.open_workbook(xlsfile)#获取sheet的数量count = len(book.sheets()) #设置连接数据库database = MySQLdb.connec...【阅读全文】
chengxuyonghu | 2017-02-25 22:28:35 | 阅读(830) | 评论(0)
最近一台服务器被攻击了,攻击者在服务器上替换了一个系统命令,如ps,ss,netstat,lsof等文件。怎么排查的就不说了。本文的主要目的是写一个检查系统用户的一个脚本,检查哪些系统用户有家目录,哪些用户没有家目录,以及哪些用户可以登录系统。我们这里的环境有点乱,有的服务器上的web用户可以登录系统,有的系统上...【阅读全文】
【系统运维】 python处理中文字符
chengxuyonghu | 2017-02-16 18:31:28 | 阅读(960) | 评论(0)
python里面默认的字符串都是ASCII编码,是string类型,ASCII编码处理中文字符是会出问题的。python的内部编码格式是unicode,在字符串前加‘u’前缀也可直接声明unicode字符串,如 u'hello'就是unicode类型。如果处理的字符串中出现非ascii码表示的字符,要想不出错,就得转成unicode编码了。具体的方法...【阅读全文】
chengxuyonghu | 2017-02-16 14:28:43 | 阅读(610) | 评论(0)
很多新手刚开始学习python的时候经常会看到python 中__name__ = \'__main__\' 这样的代码,可能很多新手一开始学习的时候都比较疑惑,python 中__name__ = '__main__' 的作用,到底干嘛的?有句话经典的概括了这段代码的意义:“Make a script both importable and executable”意思就是说让你写的脚本模块既...【阅读全文】
chengxuyonghu | 2017-02-16 11:29:33 | 阅读(1480) | 评论(0)
#!/usr/bin/pythonnum1 = input("Please input a number:")num2 = input("Please input a number:")print num1 + num2print num1 - num2print num1 * num2print num1 / num2print "%s + %s =  %s" % (num1, num2, num1 + num2)print "%s - %s =  %s" % (num1, num2, num1 - num2)print "%s * %s =  ...【阅读全文】
【系统运维】 Python内置函数
chengxuyonghu | 2017-02-13 18:47:33 | 阅读(550) | 评论(0)
Python内置的字符串处理函数整理,有字母处理、格式化相关、字符串搜索相关、字符串替换相关等等常用内置模块函数:abs(x)                    返回x的绝对值apply(func[,args[,kwargs]])        把函数的参...【阅读全文】
【系统运维】 python: mongodb应用示例
chengxuyonghu | 2017-02-12 16:38:21 | 阅读(730) | 评论(0)
1. 下载MongoDB http://downloads.mongodb.org/win32/mongodb-win32-i386-3.2.12.zip3. 设置数据文件夹,d:\mongodb\data\db5. 将MongoDB作为 Windows服务随机启动,先创建D:\mongodb\logs\mongodb.log文件,用于存储MongoDB的日志文件,再安装系统服务:--rest 参数能访问28017如果遇到默认存储引擎'wiredTi...【阅读全文】
【系统运维】 python脚本传递参数
chengxuyonghu | 2017-02-10 17:48:39 | 阅读(560) | 评论(0)
chengxuyonghu | 2017-02-09 20:49:27 | 阅读(1450) | 评论(0)
Pandas使用一个二维的数据结构DataFrame来表示表格式的数据,相比较于Numpy,Pandas可以存储混合的数据结构,同时使用NaN来表示缺失的数据,而不用像Numpy一样要手工处理缺失的数据,并且Pandas使用轴标签来表示行和列读取数据Pandas使用函数read_csv()来读取csv文件# 输出:【阅读全文】
【系统运维】 Python的CSV模块
chengxuyonghu | 2017-02-09 18:44:17 | 阅读(590) | 评论(0)
Python 的 CSV模块的使用方法,包括,reader, writer, DictReader, DictWriter.register_dialect一直非常喜欢python的csv模块,简单易用,经常在项目中使用,现在举几个例子说明一下。reader(csvfile[, dialect='excel'][, fmtparam])参数表:csvfile      &nbs...【阅读全文】
chengxuyonghu | 2017-02-09 18:25:02 | 阅读(590) | 评论(0)
python操作excel主要用到xlrd和xlwt这两个库,即xlrd是读excel,xlwt是写excel的库。可从这里下载https://pypi.python.org/pypi。下面分别记录python读和写excel.python读excel——xlrd这个过程有几个比较麻烦的问题,比如读取日期、读合并单元格内容。下面先看看基本的操作:首先读一个excel文件,有两...【阅读全文】
chengxuyonghu | 2017-02-09 11:38:20 | 阅读(690) | 评论(0)
本文转载于http://blog.csdn.net/coraline_m?viewmode=contentsxlwt 常用功能xlrd 常用功能xlutils 常用功能xlwt写Excel时公式的应用xlwt写入特定目录(路径设置)NOTICE:此外,还有xlutils.copy可以实现Excel的复制再编辑。1.python写excel — xlwt常用功能安装x...【阅读全文】
chengxuyonghu | 2017-02-08 09:46:43 | 阅读(650) | 评论(0)
1 算法1.1 字符串处理re正则表达式的标准库。StringIO / cStringIO以读写文件的方式来操作字符串(有点类似于内存文件)。cStringIO 是 C 语言实现的,提供高性能;而 StringIO 是 Python 实现的,提供 Unicode 兼容性。chardetchardet 可以猜测任意一段文本的字符集编码。对于编码类型...【阅读全文】
chengxuyonghu | 2017-02-07 18:24:40 | 阅读(470) | 评论(0)
#!/usr/bin/env python#-*-coding:utf-8-*-#平台收入日报#****************************************使用说明****************************************************# 内网测试通过命令行参数# -d 指定统计时间# -p 指定日志所在目录# -t 指定临时文件存放目录# 示例如下:# [ying@lo...【阅读全文】
chengxuyonghu | 2017-02-07 18:12:42 | 阅读(470) | 评论(0)
#!/usr/bin/env python#-*-coding:utf-8-*-import MySQLdbimport os, sys, re,stringimport time, tarfile,getoptoptmap = {                'dbuser' : 'haoren',                'dbpass' :...【阅读全文】
chengxuyonghu | 2017-02-07 17:44:50 | 阅读(560) | 评论(0)
(1)#!/usr/bin/env python#-*-coding:utf-8-*-import MySQLdbimport os, sys, re,stringimport time, tarfile,getoptoptmap = {                'dbuser' : 'haoren',                'dbpa...【阅读全文】
chengxuyonghu | 2017-02-07 17:08:01 | 阅读(1470) | 评论(0)
#查询用户余额代码案例import sysimport MySQLdbimport pandas as pdoptmap = {                'dbuser' : 'aduser',                'dbpass' : '123654',          &...【阅读全文】
【系统运维】 一个Python脚本搞定
badb0y | 2017-02-06 11:40:59 | 阅读(1080) | 评论(0)
https://mp.weixin.qq.com/s/9g2pT8JKkRgjH4tkpyxYRw【阅读全文】
gyq0618 | 2017-01-12 18:02:19 | 阅读(1710) | 评论(0)
#coding:utf-8#定义md5生成函数def md5(object):  import hashlib  md5=hashlib.md5()  md5.update(object)  return md5.hexdigest()#模拟注册账号zhdb={}def register_user(user,passwd):  if user not in zhdb.keys():    zhdb[user]=md5(user+passwd+'abc')&nbs...【阅读全文】
huaianlb | 2017-01-11 16:54:36 | 阅读(1210) | 评论(0)
1、报错信息如下:[plain] view plain copy print?[root@develop bin]# yum  [root@develop local]# yum -y install prce  There was a problem importing one of the Pytho...【阅读全文】