How can I only read from line 5000 to 6000 in this csv file for example? At this moment "for row in reader:" loops through all lines of course.
So I have the lines:
with open('A.csv', 'rt') as f:
reader = csv.reader(f, delimiter=';')
for row in reader:
response = urllib2.urlopen(row[12])
This code is used to open specific url links.
Because csv reader
object supports iteration, you can simply use itertools.islice
to slice any specific part that you want.
from itertools import islice
with open('A.csv', 'rt') as f:
reader = csv.reader(f, delimiter=';')
for row in islice(reader,5000,6000):
response = urllib2.urlopen(row[12])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With