上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 66 下一页

2015年11月20日

MySQLdb-python的安装

摘要: 第一步下载: 第一步:进入https://github.com/farcepest/MySQLdb1/ 第二步:解压 Shell>unzip/root/MySQLdb1-MySQLdb-1.3.zip Shell>cd/root/MySQLdb1-MySQLdb-1.3第三步:安装相... 阅读全文

posted @ 2015-11-20 16:50 蒋乐兴的技术随笔 阅读(317) 评论(0) 推荐(0) 编辑

2015年11月13日

python---__getattr__\__setattr_重载'.'操作

摘要: #!coding:utf-8class Person(object): def __init__(self,id): #定义一个名为ID的属性 self.ID=id def __getattr__(self,attr): #__getattr__... 阅读全文

posted @ 2015-11-13 09:18 蒋乐兴的技术随笔 阅读(387) 评论(0) 推荐(0) 编辑

2015年11月12日

python----iter\next

摘要: 1、说明:__getitem__\setitem可以迭代,它已经不被推荐了;建议使用__iter__\next。2、python会先去检查__iter__\next然后再去检查__getitem__\__setitem__,也就是说__iter__优先。例子:#!coding:utf-8#!pyth... 阅读全文

posted @ 2015-11-12 19:22 蒋乐兴的技术随笔 阅读(458) 评论(0) 推荐(0) 编辑

python--getitme\setitem 支持索引与分片

摘要: 1、想要自己定义的python对象支持索引与分片操作就要重载__getitem__\__setitem__这两个方法。2、__getitme__(self,index) 这里的index参数可能类型有两种int,slice。当它是int类型时对应索引操作,当它是slice时对应分片操作。3、__s... 阅读全文

posted @ 2015-11-12 18:24 蒋乐兴的技术随笔 阅读(385) 评论(0) 推荐(0) 编辑

2015年11月10日

linux----ln

摘要: 1、格式 ln source_file_path target_file_path2、执行ln 命令的用户要对source_file_path有写权限,才可以创建软连接。3、souce_file这个文件对ln的执行者要是可达的,也就是说ln的执行者要对source_file的上层目录有x权限。例子:... 阅读全文

posted @ 2015-11-10 17:52 蒋乐兴的技术随笔 阅读(7287) 评论(0) 推荐(0) 编辑

linux----suid\sgid

摘要: 1、suid和sgid 都是针对二进制程序来说了,bash脚本不在它的作用范围。2、如果一个二进制文件设置有suid,那么在userA用户执行它时,会以文件所属用户的身份来执行。sgid同理;3、suid的优先级别比sgid的要大,也就是说如果同时设置了这两个话,和只设置suid一样;4、一般说来一... 阅读全文

posted @ 2015-11-10 17:26 蒋乐兴的技术随笔 阅读(329) 评论(0) 推荐(0) 编辑

2015年11月9日

python生成随机密码

摘要: import randomstrings=list('qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM')random.shuffle(strings)#改变strings内容元素的排列次序print ''.join(ran... 阅读全文

posted @ 2015-11-09 18:23 蒋乐兴的技术随笔 阅读(247) 评论(0) 推荐(0) 编辑

python计算md5值

摘要: from hashlib import md5m = md5('123456')print m.hexdigest() 阅读全文

posted @ 2015-11-09 18:20 蒋乐兴的技术随笔 阅读(166) 评论(0) 推荐(0) 编辑

2015年11月5日

python---连接MySQL第五页

摘要: Connector/Python Connection ArgumentsA connection with the MySQL server can be established using either the mysql.connector.connect() function or the ... 阅读全文

posted @ 2015-11-05 12:58 蒋乐兴的技术随笔 阅读(793) 评论(0) 推荐(0) 编辑

python---连接MySQL第四页

摘要: python缓存结果集式的cursor可以用来提高性能。例子:#!conding:utf-8from mysql.connector import errorcodeimport mysql.connectorcnx=Nonecursor=Nonetry: cnx = mysql.connec... 阅读全文

posted @ 2015-11-05 12:54 蒋乐兴的技术随笔 阅读(243) 评论(0) 推荐(0) 编辑

上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 66 下一页

导航