creat_listPage_task_from_baike.py 413 B

12345678910111213141516171819202122
  1. # coding=utf-8
  2. '''
  3. Created on 2016年3月9日
  4. @author: ChenHao
  5. '''
  6. import json
  7. import codecs
  8. ls = list()
  9. for i in range(21087, 24087):
  10. d = dict()
  11. d["url"] = "http://baike.baidu.com/view/" + str(i) + ".html"
  12. d["id"] = 1
  13. d["number"] = i
  14. ls.append(d)
  15. st = json.dumps(ls, ensure_ascii=False)
  16. fileName = "1.txt"
  17. fout = codecs.open(fileName, 'w', encoding='utf-8')
  18. fout.write(st)
  19. fout.close()