2005年06月09日 星期四 19:18
程序目的:把WINDOWS收藏夹的收藏导出成一个HMTL文件.
错误:中文无法显示.
OS:red hat linux 9.0
#!/usr/bin/python
#filename:os.py
import glob
import cPickle
hreffile="href.html"
a=glob.glob("*.url")
for word in a:
f=file(word,'r')
for i in range(1,5):
line = f.readline()
httpstr=line[4:len(line)-2]
f.close()
httpstr1=u'word[:len(word)-4]'
hrefstr=""+httpstr1+""
print hrefstr
print "\n\r"
ff=file(hreffile,'a')
cPickle.dump(hrefstr,ff)
ff.close()
else:
print "Total:",len(a)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050609/e6ef5d31/attachment.htm
2005年06月09日 星期四 19:22
大家好!
就像java servlet里面可以使用 session.setAttribute("name", value)一样保存一个变量,然后使用session.getAttribute("name")获取值。
致
礼!
陈锦
jeekchen at 163.com
2005-06-09
2005年06月09日 星期四 20:01
没有缩近,另外为什么要使用cPickle呢?不是想存成一个HTML吗?而且目的是windows下的,OS怎么是linux?搞不懂。 在 05-6-9,程启盛<cqs1015 at 163.com> 写道: > 程序目的:把WINDOWS收藏夹的收藏导出成一个HMTL文件. > 错误:中文无法显示. > OS:red hat linux 9.0 > > #!/usr/bin/python > #filename:os.py > import glob > import cPickle > hreffile="href.html" > a=glob.glob("*.url") > for word in a: > f=file(word,'r') > for i in range(1,5): > line = f.readline() > httpstr=line[4:len(line)-2] > f.close() > httpstr1=u'word[:len(word)-4]' > hrefstr=""+httpstr1+"" > print hrefstr > print "\n\r" > ff=file(hreffile,'a') > cPickle.dump(hrefstr,ff) > ff.close() > else: > print "Total:",len(a) > > > > > > > > > 已有1亿用户选择了网易邮箱,你呢? > 网易163免费邮已全面升级至2000兆超大空间,支持收发30兆超大附件! > 注册登录网易邮箱,每周都有惊喜,50元现金券完全白送,点击查看活动详情! > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > > > -- I like python! My Donews Blog: http://www.donews.net/limodou New Google Maillist: http://groups-beta.google.com/group/python-cn
2005年06月09日 星期四 20:08
程启盛 wrote:
> 程序目的:把WINDOWS收藏夹的收藏导出成一个HMTL文件.
> 错误:中文无法显示.
> OS:red hat linux 9.0
>
> #!/usr/bin/python
> #filename:os.py
> import glob
> import cPickle
> hreffile="href.html"
> a=glob.glob("*.url")
> for word in a:
> f=file(word,'r')
> for i in range(1,5):
> line = f.readline()
> httpstr=line[4:len(line)-2]
> f.close()
> httpstr1=u'word[:len(word)-4]'
> hrefstr=""+httpstr1+""
> print hrefstr
> print "\n\r"
> ff=file(hreffile,'a')
> cPickle.dump(hrefstr,ff)
> ff.close()
> else:
> print "Total:",len(a)
没有缩进,看着太累。
建议重新发一份格式正确的。
--
Qiangning Hong
_____________________________________________
( Women's virtue is man's greatest invention. )
( )
( -- Cornelia Otis Skinner )
---------------------------------------------
o
o
("`-' '-/") .___..--' ' "`-._
` *_ * ) `-. ( ) .`-.__. `)
(_Y_.) ' ._ ) `._` ; `` -. .-'
_.. `--'_..-_/ /--' _ .' ,4
( i l ),-'' ( l i),' ( ( ! .-'
Zeuux © 2025
京ICP备05028076号