title: How to remove a row in a CSV file while looping through each row to run a function?
body: <p>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</p>
  <pre><code>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(&quot;repository: &quot; + str(x))
              print(&quot;1) Migrate repo&quot;)
              print(&quot;2) Skip repo&quot;)
              print(&quot;3) Exit&quot;)
              a = input(&quot;Please choose an option above: &quot;)
  </code></pre>
  <p>The CSV looks like this but each URL is different. There are also no headers and its only in one column:</p>
  <pre><code>http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
  http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
  http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
  http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
  http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
  http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
  http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
  http://ajdhfajdhfasdhflkjashdflkjahsdfjasdl
  etc.
  </code></pre>
  <p>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.</p>