I want to open a csv file, and count the rows inside it, if it is < 10 do my funciton again, if not continue with while. Where i can implement it?
My code :
def test():
#here i wrote a webscraping part...
while True:
mytime=datetime.now().strftime("%H:%M:%S")
while mytime == "00:01:00" :
print mytime
test()
mytime=datetime.now().strftime("%H:%M:%S")
I want to implement this part, but where I have to write? Inside my def(test) or outside? And my ELSE is correct? :
with open(test.csv,"r") as f:
reader = csv.reader(f,delimiter = ";")
data = list(reader)
row_count = len(data)
if row_count < 10 :
test()
else:
pass
Aucun commentaire:
Enregistrer un commentaire