Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
146 views
in Technique[技术] by (71.8m points)

python - run function so often like lines in a csv file

I have a csv file with multiple lines, a line contains a name, city and a street.

So one line looks like this:

Peter,Berlin,Kurfürstendamm

My function send the name, city and street to a form on a website. Now I want to know if I can read the lines and the function send the first line of name, city and street to the form and if it's done it sends the next line of name, city and street to the form (so often as lines in the csv file).

I already tried this:

with open('profiles.csv') as f:
    lines = f.readlines()[1:]
    for line in lines:
        line = line.strip()
        signup(line)

The [1:] is to skip the first line because the first line only contains the title of the name, city and street rows.

question from:https://stackoverflow.com/questions/65645063/run-function-so-often-like-lines-in-a-csv-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...