logpuzzle/logpuzzle.py
def download_images(img_urls, dest_dir):
  """Given the urls already in the correct order, downloads
  each image into the given directory.
  Gives the images local filenames img0, img1, and so on.
  Creates an index.html in the directory
  with an img tag to show each local image file.
  Creates the directory if necessary.
  """
  # print(img_urls)
  if not os.path.exists(dest_dir):
      os.makedirs(dest_dir)

  index = file(os.path.join(dest_dir, 'index.html'), 'w')
  index.write('<html><body>\n')
  # +++your code here+++
  i = 0
  for url in img_urls:
      fname = 'img%d' % i + '.jpg'
      urllib.urlretrieve(url, os.path.join(dest_dir, fname))
      print("Retrieving image url: " + url)
      index.write('<img src="'+fname+'"/>')
      i += 1

  index.write('\n</body></html>\n')
  index.close()
Given the urls already in the correct order, downloads
  each image into the given directory.
  Gives the images local filenames img0, img1, and so on.
  Creates an index.html in the directory
  with an img tag to show each local image file.
  Creates the directory if necessary.
  
Given the urls already in the correct order, downloads
each image into the given directory.
Gives the images local filenames img0, img1, and so on.
Creates an index.html in the directory
with an img tag to show each local image file.
Creates the directory if necessary.
Given the urls already in the correct order downloads each image into the given directory . Gives the images local filenames img0 img1 and so on . Creates an index . html in the directory with an img tag to show each local image file . Creates the directory if necessary .
def download_images(img_urls, dest_dir):
  if not os.path.exists(dest_dir):
      os.makedirs(dest_dir)
  index = file(os.path.join(dest_dir, 'index.html'), 'w')
  index.write('<html><body>\n')
  i = 0
  for url in img_urls:
      fname = 'img%d' % i + '.jpg'
      urllib.urlretrieve(url, os.path.join(dest_dir, fname))
      print("Retrieving image url: " + url)
      index.write('<img src="'+fname+'"/>')
      i += 1
  index.write('\n</body></html>\n')
  index.close()
def download_images ( img_urls , dest_dir ) : if not os . path . exists ( dest_dir ) : os . makedirs ( dest_dir ) index = file ( os . path . join ( dest_dir , 'index.html' ) , 'w' ) index . write ( '<html><body>\n' ) i = 0 for url in img_urls : fname = 'img%d' % i + '.jpg' urllib . urlretrieve ( url , os . path . join ( dest_dir , fname ) ) print ( "Retrieving image url: " + url ) index . write ( '<img src="' + fname + '"/>' ) i += 1 index . write ( '\n</body></html>\n' ) index . close ( )
Given the urls already in the correct order, downloads
each image into the given directory.
Given the urls already in the correct order downloads each image into the given directory .
"""Given the urls already in the correct order, downloads
  each image into the given directory.
  Gives the images local filenames img0, img1, and so on.
  Creates an index.html in the directory
  with an img tag to show each local image file.
  Creates the directory if necessary.
  """ # print(img_urls) # +++your code here+++
img_urls
dest_dir