Heim >Backend-Entwicklung >Python-Tutorial >ptyhon实现sitemap生成示例

ptyhon实现sitemap生成示例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-16 08:44:381220Durchsuche

复制代码 代码如下:

# _*_ coding:utf-8 _*_

#xiaohei.python.seo.call.me:)
#win+python2.7.x

id_ = 1
f = open('clubpop%s.xml' % id_, 'w')

for i, line in enumerate(open('suk.csv')):
        if i % 50000==0:
                print i
                f.write('\n\n')

        f.write('''    
                http://www.jb51.net/review/%s-1-1.html
       

''' % line.rstrip())
        if i % 50000==49999:
                f.write('
')
                f.close()
                id_ += 1
                f = open('clubpop%s.xml' % id_, 'w')
f.write('')
f.close()

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn