The task is to read the desired line from the products_links.csv file and get the string to later use it as a URL.

I know that the code is not written correctly. Having studied the documentation here - https://docs.python.org/release/3.2/library/csv.html , I still do not understand how I can do what is needed.

import csv k = 0 n = 1 def read_csv(k,n): reader = csv.reader(open("products_links.csv", newline='')) next(reader) #Знаю, что пропускать fieldsname можно и нужно иначе, задача не в этом. while k < n: d = (next(reader)) k += 1 return d d = read_csv(k, n) f = d[0] print(f) 

    1 answer 1

    The task was solved as follows:

     import csv with open('products_links.csv') as f: r = csv.reader(f) cont = [row for row in r] k = 3 d = cont[k] print (d[0]) 

    The code was written a little in the form in which it was originally when raising the question, however, I think that the answer will be able to push the seekers to the right path.