您的位置:首页 > 编程语言 > Python开发

Python学习积累《二》

2013-09-15 10:23 169 查看
[b]1.Python学习积累《二》 Python的内省机制[/b]
/article/8090122.html



[b]2.Python 命名规范[/b]


[b]http://my.oschina.net/hcp/blog/40979[/b]

3. Python模块学习 ---- httplibHTTP协议客户端实现


http://blog.csdn.net/JGood/article/details/4317416

http://www.sandzhang.com/blog/2010/04/09/pyhon-use-httplib-send-http-get-post/

http://blog.sina.com.cn/s/blog_524524850100vfbj.html (提交表单数据)

4. Python中 函数返回多个值

class MultiReturn:
def__init__(self,name,age):

self.Name=name

self.Age=age

def printinfo(self):

return self.Name,self.Age

test=MultiReturn('Cheers Li',29)

aa=test.printinfo()

print aa[0]

print aa[1]

5. Python 从数据读取数据,并逐行写入到文本文件。

import MySQLdb

f=open('D:\\temp\\testdata\\test1.txt','w')
conn =MySQLdb.connect(host="192.168.1.23",\
user="root", \
passwd="password", \
db="sstestpfm1")
cursor = conn.cursor()
cursor.execute("select fileserver_user.identifier fromfileserver_user;")
for row in cursor.fetchall():
for pair in zip(row):
a='%s'%pair
printa
f.write(a+'\n')
f.close()
cursor.close()
conn.close()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: