title: Python: How to store result of a daterange on a var list
body: <pre><code>import datetime
  import re
  import pymongo
  from datetime import timedelta, date
  
  def daterange(d, d1):
      for n in range(int ((d1 - d).days)):
          yield d + timedelta(n)
  
  #conect bd
  uri = "mongodb://127.0.0.1:27017"
  client = pymongo.MongoClient(uri)
  database = client['db']
  collection = database['currency']
  
  
  d = input('Insert beginning date (yyyy-mm-dd): ')
  d1 = input('Insert end date (yyyy-mm-dd): ')
  
  #search bd
  item = collection.find_one({"date" : d})
  item1 = collection.find_one({"date" : d1})
  d = collection.find_one({})
  d1 = collection.find_one({})
  datas = item['date']
  datas1 = item1['date']
  
  #conversão de string para objecto
  dataObject = datetime.datetime.strptime(datas, "%Y-%m-%d")
  dataObject1 = datetime.datetime.strptime(datas1, "%Y-%m-%d")
  
  #range
  for single_date in daterange(dataObject, dataObject1):
      print (single_date.strftime("%Y-%m-%d"))
  </code></pre>
  
  <p>I want to make the output of this code into a var list if it's possible.
  For example beginning date is 2018-05-07 and the end date is 2018-05-11 and the output is:</p>
  
  <pre><code>2018-05-07
  2018-05-08
  2018-05-09
  2018-05-10
  </code></pre>
  
  <p>How do I put that into a variable?</p>