- # _*_ 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('<?xml version="1.0" encoding="UTF-8"?>\\n<urlset>\\n')
- f.write(''' <url>
- <loc>http://club.jd.com/review/%s-1-1.html</loc>
- </url>
- ''' % line.rstrip())
- if i % 50000==49999:
- f.write('</urlset>')
- f.close()
- id_ += 1
- f = open('clubpop%s.xml' % id_, 'w')
- f.write('</urlset>')
- f.close()
- #该片段来自于http://www.codesnippet.cn/detail/221020136582.html
来源: http://www.codesnippet.cn/detail/221020136582.html