【发布时间】:2013-06-24 11:59:17
【问题描述】:
我有这样的代码:
count = 0
for line in lines:
#do something with line
#do something more with line
#finish doing that thing with line
count = count + 1
if count % 10000 == 0:
print count
这是在 python 中维护计数变量的正确方法吗?我可以让它看起来更好吗?
【问题讨论】:
-
我建议你看看这个视频youtube.com/watch?v=OSGv2VnC0go它将向你介绍更多Pythonic的编码方式。
标签: python coding-style pep