import os
imagelist = []
for line in open('/tmp/imagelist_parse4.txt').xreadlines():
imagelist.append(line)
imagelist.sort()
outfile = open('/tmp/imagelist_parse4_sorted.txt', 'w')
outfile.writelines(imagelist)
outfile.close()
这会攫取文件内容,并存储为列表,对其排序,然后另存为另一个文件。 之后,我可以做到以下几点:
ls /home/gregp/development/Scribus15x/doc/en/images/*.png > '/tmp/actual_images.txt'
index = 3
while index < linelength:
if (all_text[index] == '='):
if (all_text[index-3] == 's') and (all_text[index-2] == 'r') and (all_text[index-1] == 'c'):
imagefound(all_text, imagelist,
推荐阅读
沙龙晃荡 | 3月31日 京东、微博、华为拭魅战专家与你合营商量容器技巧实践! 2015年,固执的苹不雅也推出了带压力感应的手写笔,然则迄今为止,这个笔如今只能在iPad Pro上应用,这让苹不雅>>>详细阅读
本文标题:如何用Python解析HTML?
地址:http://www.17bianji.com/lsqh/40963.html
1/2 1