易截截图软件、单文件、免安装、纯绿色、仅160KB

Python学习札记

Ubuntu平台下的Python操作Mysql
1.安装Ubuntu,安装Msql.
2.打开终端,输入 python
import MySQLdb
con = MySQLdb.connect(db="python")
cur = con.cursor()
count = cur.execute("select * from test")
print count
data = cur.fetchall()
print data
for d in data:
print d
import os
os.system('clear') # clear screen
count = cur.execute("delete from test where id =1")
print count
count = cur.execute("select * from test")
print count
cur.close()
con.commit()
con.close()

ps.python学习书籍
1.python简明教程
  http://www.woodpecker.org.cn:9081/doc/abyteofpython_cn/chinese/
2.python核心编程(第二版)


相关文档:

python 基础

   Python快速入门
                        目录
1. 第一章 Python快速入门
                &nbs ......

python random 随机的问题

在一个项目中需要获取随机数,谁知道遇到点问题:随机数不随机。所以我写了个简单原型。看下到底是啥问题。
import os,random,sys,time
while True:
father = os.fork()
if father:
time.sleep(2)
rd = 7
else:
#random.seed()
rd = random.choice([2,3,4,5])
......

Python中的字符串与字符集

Python支持ascii字符串,unicode字符串,以及各种字符集,那么它们到底各是什么概念,相互之间存在何种关系呢?
在Python中,ascii字符串,即str类型的值,可能用来表示任意的一块存储空间,那么也就是说,这个字符串内部可以是任何值,例如:可见字符组成的字符串,或者一段二进制数据等。unicode字符串,即unicode类型的 ......

Python简易股票查询(抓取google财经的内容)


看着网上抓取网页数据的文章直瞪眼
后来想到用字符串分割来提取相应部分的内容
程序简单,但数行数和下标费了很长时间
我知道这肯定不是最好的办法- -!!
但我实现了,哈哈
# -*- coding: cp936 -*-
from urllib import *
import re
def stockSearch():
    baseurl="http://www.google.cn/financ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号