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

写了几个有关operaminimod的python小程序

写了几个有关operaminimod的python小程序
firefox->opm书签转换
import re
def pipeiwangzhi(a):
    s=[]
    pp= re.compile(r'<DT><A HREF="(.*)" ADD_DATE=(.*>)(.*)</A>')
    m=pp.search(a)
    s1=[]
    if m!=None:
        s=m.groups()       
        s1.append(s[0])
        s1.append(s[2])
    return s1
fnlang='f:\\bookmarks.html'
f1 = open(fnlang,'rb')
ffbk=f1.readlines()        
f1.close()
opbkmg=[]
for i in ffbk:
    a=i.decode('utf-8')
    ss=[]
    ss=pipeiwangzhi(a)
    if ss!=[]:
        opbkmg.append(ss)
#print(opbkmg)
tou="""<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<!--This is generated file from Opera Mini mod v.3.12.
It will be read and overwritten.
Do Not Edit! -->
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><P>\n"""
x1='<DT><img src="" alt="" width="12" height="12" /><A HREF="'
x2='">'
x3='</A><PARAM NAME="fav" VALUE="0:/">\n'
wei='</DL><P>'
opbk=''
for i in opbkmg:
    opbk+=x1+i[0]+x2+i[1]+x3
   
opbk=tou+opbk+wei
   
   
#print(opbk.encode('utf-8'))
fnlang='f:\\bookmarks.htm'
f1 = open(fnlang,'wb')
f1.write(opbk.encode('utf-8'))        
f1.close()


相关文档:

Python多线程 简明例子

综述
 
  多线程是程序设计中的一个重要方面,尤其是在服务器Deamon程序方面。无论何种系统,线程调度的开销都比传统的进程要快得多。
 
Python可以方便地支持多线程。可以快速创建线程、互斥锁、信号量等等元素,支持线程读写同步互斥。美中不足的是,Python的运行在Python
虚拟机上,创建的多线程可 ......

Python性能测试函数

Python 社区有句俗语:“Python 自己带着电池。” 别自己写计时框架。Python 2.3以后 、具备一个叫做 timeit 的完美计时工具。DiveInto中的例子
>>> import timeit
>>> t = timeit.Timer("soundex.soundex('Pilgrim')",
... "import soundex")
>>> t.timeit() ......

用python连接mysql数据库


#
-*- encoding: gb2312 -*-
import
os, sys, string
import
MySQLdb
#
连接数据库
try
:
conn
=
MySQLdb.connect(host
=
'
localhost
'
,user
=
'
root
'
,passwd
=
'
xxxx
'
,db
=
'
test1
'
)
except
Exception, e:
print
e
sys.exit()
......

[Python module] multiprocessing


multiprocessing — Process-based “threading” interface
Introduction
multiprocessing is a package that supports spawning processes using an API similar to the threading module. The multiprocessing package offers both local and remote concurrency, effectively side-stepping the Glo ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号