fork download
  1. SEP = '---------'
  2.  
  3. with open('page.txt','r') as f:
  4. s=f.read()
  5. pat="""
  6. India
  7. </td>"""
  8. l=s.split(pat)
  9. st=set()
  10. tot=0
  11. ac=0
  12. for x in l:
  13. if x.find("ACCEPTED")!=-1:
  14. pos=x.find("""class="ui-widget-content ui-datatable-""")
  15. end=x.find("""</td><td role="gridcell"><img id="j_""")
  16. x=x[pos:end]
  17. start=x.find("""<td role="gridcell">""")
  18. x=x[start:end]
  19. ss="""<td role="gridcell">"""
  20. lenss=len(ss)
  21. x=x[lenss:]
  22. st.add(x)
  23.  
  24. l=list(st)
  25. l.sort()
  26. print 'Total no. of distinct colleges = ' + str(len(l))
  27. l=l[1:]
  28. cnt=1
  29. for x in l:
  30. print "{0}. {1}".format(cnt,x)
  31. cnt+=1
Runtime error #stdin #stdout #stderr 0s 7892KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 3, in <module>
IOError: [Errno 2] No such file or directory: 'page.txt'