Python学习积累《二》

1.Python学习积累《二》 Python的内省机制

2.Python 命名规范 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()




 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值