title: looping over images in a directory
body: <p>I have images in the same directory with a python file, i am trying to loop over the images and convert them into  base64 but am getting this error.
  Am using Ubuntu 14.0.4</p>
  
  <pre><code>    Traceback (most recent call last):
    File "convert_to_base64.py", line 33, in &lt;module&gt;
      print(main())
    File "convert_to_base64.py", line 26, in main
      convert_to_base64()
    File "convert_to_base64.py", line 19, in convert_to_base64
      with open("*.jpg", "rb") as f:
  IOError: [Errno 2] No such file or directory: '*.jpg'
  </code></pre>
  
  <p>Here is my python code</p>
  
  <pre><code># -*- coding: utf-8 -*-
  import os
  import sys
  import xlrd
  import base64
  import urllib
  from datetime import datetime
  
  reload(sys)  # to re-enable sys.setdefaultencoding()
  sys.setdefaultencoding('utf-8')
  
  
  def convert_to_base64():
      """
      Read all jpg images in a folder,
      and print them in base64
     """
      with open("*.jpg", "rb") as f:
          data = base64.b64decode(f.read())
      print data
  
  
  def main():
      start_datetime = datetime.now()
      convert_to_base64()
      end_datetime = datetime.now()
      print '------------------------------------------------------'
      print 'Script started  : {}'.format(start_datetime)
      print 'Script finished: {}'.format(end_datetime)
  
  if __name__ == '__main__':
      print(main())
      print('Done')
  </code></pre>
  
  <p>someone help me figure out what am doing wrong.
  Thanks</p>