Movatterモバイル変換


[0]ホーム

URL:


Sorry, we no longer support your browser
Please upgrade toMicrosoft Edge,Google Chrome, orFirefox. Learn more about ourbrowser support.
Skip to main content

Stack Exchange Network

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 Exchange
Loading…
Code Review

Return to Answer

added 87 characters in body

I'll start with the obvious:

while submissions > 0:    ...    submissions -= 1

can 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!).
  • You appear to be parsing HTML usingstring.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).
  • You're not using thepprint import, so you might as well remove that line.

I'll start with the obvious:

while submissions > 0:    ...    submissions -= 1

can 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.
  • You appear to be parsing HTML usingstring.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).
  • You're not using thepprint import, so you might as well remove that line.

I'll start with the obvious:

while submissions > 0:    ...    submissions -= 1

can 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!).
  • You appear to be parsing HTML usingstring.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).
  • You're not using thepprint import, so you might as well remove that line.

I'll start with the obvious:

while submissions > 0:    ...    submissions -= 1

can 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.
  • You appear to be parsing HTML usingstring.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).
  • You're not using thepprint import, so you might as well remove that line.
lang-py

[8]ページ先頭

©2009-2025 Movatter.jp