title: How can I set a value from a function to a CSV?
body: <p>I am a new coder trying to build a twitter bot that automatically tweets based on some data I have created. Right now, I want to set a tweet that I grabbed as "tweeted". I want to open the CSV and set the field "tweeted" with a "1". </p>
  
  <p>I have read quite a bit but I am having a hard time with the examples because they don't pertain to my code. (Again, sorry I'm new.)</p>
  
  <p>This is what I have so far to get to the row that I have already tweeted</p>
  
  <pre><code>def markastweeted():
      """Sets tweeted field to 1"""
      with open("data.csv", "r+") as csvDataFile:
          quotesdb = list(csv.DictReader(csvDataFile))
          for line in quotesdb:
  
              #Field names in CSV
              #----- id_serial
              #----- id_season
              #----- quote
              #----- file_path
              #----- id_group
              #----- trigger_time
              #----- tweeted
  
              #----- check "tweeted" field for data -- if true go to next row
              if line['tweeted'] == ("1"):
                  pass
  
              if line['tweeted'] == (""):
  </code></pre>
  
  <p>In my other function that returns the tweet, I have:</p>
  
  <pre><code>if line['tweeted'] == (""):
       return line['tweet']
  </code></pre>
  
  <p>but here I would like to have something like this:</p>
  
  <pre><code>if line['tweeted'] == (""):
       set line['tweeted'] with "1"
  </code></pre>
  
  <p>Any help is appreciated! Thanks!</p>