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

用Eclipse编译向sqlite数据库插入数据的python程序

今天遇到了麻烦:
      用Eclipse编译python向sqlite数据库插入数据总是提示编码的问题,我设置了Eclipse的workspace用utf-8编码还是不行
但是用Eclipse写的程序保存再用IDLE打开却能编译,奇怪了
我考虑到可能是配置的原因,找找遍了所有的配置,都没有问题,包括工程文件
最后我用xvi32打开两个相同的程序(Eclipse和IDLE分别编写的)发现了问题
原来Eclipse保存的文件虽然是utf-8编码但是在文件的头部不加\ff\bb\bf,而IDLE没有标识也能识别utf-8(默认的嘛)
而eclipse却不能(也许是我的Eclipse的原因~~!)
再一个用IDLE写的自动就加标识了,就像是用记事本utf-8保存一样


相关文档:

使用python获取html页面的内容

import urllib
from HTMLParser import HTMLParser
class TitleParser(HTMLParser):
def __init__(self):
self.title = ''
self.divcontent = ''
self.readingtitle = 0
self.readingdiv = 0
HTMLParser.__init__(self)
def handle_starttag(self, tag, attrs): ......

Python Socket编程

1,编写Server.py
import socket
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.bind(('localhost',8081))
while True:
    data,addr=s.recvfrom(1024)
    print 'receive:',data,'from',addr
2,编写Client.py
import socket
s=socket.socket(socket.AF_INET,socket.SOC ......

话说Python(三)万恶的编码

万恶的编码
小菜对于老师上一节讲的不是很明白,因为没有一本书是将文件与web一起讲授的,他决定自己探究一下它们之间的不同:
首先,小菜在C盘建了一个文本文档 file.txt,输入四个字:我是小菜。
然后,小菜在shell中练习起来:
>>> file=open("c:\\file.txt","r")
>>> data=file.read()
>> ......

Install Python + Eric IDE


Install Python Eric IDE
1 Download following things
 
1) Python3.1
 
2) PyQt for python 3.1
(http://www.riverbankcomputing.co.uk/software/pyqt/download) I am using
PyQt-Py3.1-gpl-4.7.3-2.exe
 
3) Eric5 IDE
(http://eric-ide.python-projects.org/eric-download.html)
 
2 ......

python 笔记 for loop and extend, append

list.append(item)
list.extend(sequence)
http://docs.python.org/tutorial/datastructures.html
http://docs.python.org/library/functions.html 这几天看一下
python howto
恩。python documentation 确实很好很强大啊!
list.append(x)Add an item to the end of the list; equivalent to a[len(a):]&n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号