I have a program that will loop through a CSV file and execute a function on each line in the CSV to perform a task. Once that task his performed, I want to be able to remove that line in the CSV to be able to keep track of what was changed while the script is running. Below is the part of the code that loops through the CSV file
def migrate_repo(team_name, gh_token):
with open('Repositories.csv', 'r') as csv_file:
reader = csv.reader(csv_file)
for x in reader:
print("repository: " + str(x))
print("1) Migrate repo")
print("2) Skip repo")
print("3) Exit")
a = input("Please choose an option above: ")
The CSV looks like this but each URL is different. There are also no headers and its only in one column:
http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
etc.
I want to be able to remove the row after the while loop finishes its task on that specific row and moves onto the next row.