Stack Exchange network consists of 183 Q&A communities includingStack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeI'll start with the obvious:
while submissions > 0: ... submissions -= 1can be transformed into:
for _ in xrange(submissions): ...There are other changes that I think would make the code slightly better, albeit not necessarily more pythonic:
submissions should probably be namedsubmissionCountsubmission_count (thanks,Ludisposed!).string.split(). It might work OK now, but if you need to add more functionality in the future this approach will be very cumbersome. Try using a library instead (for example,Beautiful Soup).pprint import, so you might as well remove that line.I'll start with the obvious:
while submissions > 0: ... submissions -= 1can be transformed into:
for _ in xrange(submissions): ...There are other changes that I think would make the code slightly better, albeit not necessarily more pythonic:
submissions should probably be namedsubmissionCount.string.split(). It might work OK now, but if you need to add more functionality in the future this approach will be very cumbersome. Try using a library instead (for example,Beautiful Soup).pprint import, so you might as well remove that line.I'll start with the obvious:
while submissions > 0: ... submissions -= 1can be transformed into:
for _ in xrange(submissions): ...There are other changes that I think would make the code slightly better, albeit not necessarily more pythonic:
submissions should probably be namedsubmission_count (thanks,Ludisposed!).string.split(). It might work OK now, but if you need to add more functionality in the future this approach will be very cumbersome. Try using a library instead (for example,Beautiful Soup).pprint import, so you might as well remove that line.I'll start with the obvious:
while submissions > 0: ... submissions -= 1can be transformed into:
for _ in xrange(submissions): ...There are other changes that I think would make the code slightly better, albeit not necessarily more pythonic:
submissions should probably be namedsubmissionCount.string.split(). It might work OK now, but if you need to add more functionality in the future this approach will be very cumbersome. Try using a library instead (for example,Beautiful Soup).pprint import, so you might as well remove that line.