D
D
dontgiveafcuk2018-02-28 03:53:46
Python
dontgiveafcuk, 2018-02-28 03:53:46

How to remove row from csv after reading by loop?

def readFile(file_object):
    reader = csv.reader(file_object)

    for row in reader:
        status = api.get_status(row[0])
        api.retweet(status.id)
        print('Just retweeted the status with ID: %s' % (status.id))
        ## В ЭТОТ МОМЕНТ НУЖНО УДАЛИТЬ ПРОЧИТАННУЮ СТРОКУ(РЯД)
        time.sleep(10)


if __name__ == "__main__":
  
   
    csv_path = 'data.csv'
    with open(csv_path, 'rt') as dataFile:
        readFile(dataFile)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dontgiveafcuk, 2018-02-28
@dontgiveafcuk

little off topic question.
There is a list ['rt','retweet']
How to make it so that when searching rt is perceived as one word and not just as two letters.
That is, after the filter, tweets with the word rt are selected and not, for example, Par rt y

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question