fork download
  1. import urllib2
  2. import json
  3.  
  4. listNames = open('list.txt', 'r')
  5. ans = open('ans.txt', 'w')
  6.  
  7. a = ''
  8. ls = []
  9. for s in listNames :
  10. s = s[0:len(s) - 1]
  11.  
  12. if(len(a) > 0) :
  13. a += ';'
  14. a += s
  15. ls.append(s)
  16.  
  17. if(len(ls) == 500) :
  18. data = json.load(urllib2.urlopen('http://c...content-available-to-author-only...s.com/api/user.info?handles=' + a))
  19. for i in range(len(ls)) :
  20. ans.write(ls[i])
  21. ans.write(' ' + str(data[u'result'][i][u'friendOfCount']) + '\n')
  22.  
  23. ls = []
  24. a = ''
  25.  
  26. if(len(ls) > 0) :
  27. data = json.load(urllib2.urlopen('http://c...content-available-to-author-only...s.com/api/user.info?handles=' + a))
  28. for i in range(len(ls)) :
  29. ans.write(ls[i])
  30. ans.write(' ' + str(data[u'result'][i][u'friendOfCount']) + '\n')
  31.  
Runtime error #stdin #stdout #stderr 0.03s 13168KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 4, in <module>
IOError: [Errno 2] No such file or directory: 'list.txt'