用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保存一样
相关文档:
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):
......
本文以数据库中的数据表UserInfo为实例展示数据库表的创建及数据记录的录入。
#!/bin/sh
#variables definition
#database location
db=/conf/db
#
#create table userInfo
#name: User name
#passwd: Password
#Privilege: User privilege -- Administrator:0 Operator:1
#
echo "create table UserInfo(n ......
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 ......
package
{
import flash.data.SQLConnection;
import flash.data.SQLResult;
import flash.data.SQLStatement;
import flash.errors.SQLError;
import flash.events.SQLErrorEvent;
import flash.events.SQLEvent;
import flash.filesystem.File;
import mx.collections.Ar ......