易截截图软件、单文件、免安装、纯绿色、仅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中执行shell命令的实例

1。
myCoolVariable="some_string"
os.system("echo myCoolVariable")
2.
>>> os.system('echo "asdg"')
asdg
0
>>> os.system("echo 'asdgwere'")
asdgwere
0
3.
$ python
>>>hamburger="potato"
>>>import os
>>>os.system("echo 'hamburger'")
potato
0
......

Python中的字符串与字符集

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

python_复杂数据类型

python_复杂数据类型
python中原生的队列有2种,一种是普通的队列(Queue),一种叫做优先队列(PriorityQueue),即小的先出列。
注意:队列是线程安全的,python 3.0中支持多进程,也有类似的Queue,但不是这个。
1栈、队列、堆
  python中原生的队列有2种,一种是普通的队列(Queue),一种叫做优先队列(PriorityQueu ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号