我有问题摆脱了Python中的循环。它只是不会爆发。不能摆脱Python循环
这里是dl.py:
#! /usr/bin/python
import urllib
import urllib2
import os
import sys
import re
from pyquery import PyQuery as pq
url = sys.argv[1]
limit = sys.argv[2]
count = 0
while True :
if count >= limit :
break
print 1;
count += 1
print 'Complete ... exiting';
它只是循环永远,我不明白为什么。 Python不是我的母语,我用它来编写一些shell脚本。
我运行它像这样./dl.py http://url.com 3
我在做什么错?
这可能是因为'limit'是一个字符串,尝试'计数> = int(limit)'你也可以改变'for'循环的'while'。 – fredtantini 2014-09-18 21:49:48
@Cyber这不是如何工作! – jonrsharpe 2014-09-18 21:50:58