title: Naming downloaded files in Python
body: <p>Hello stackoverflow angels.</p>
  <p>I'm trying to name some images with the header names as a prefix. Here's the code</p>
  <pre><code>import requests
  import itertools
  import pandas as pd
  
  lista = pd.read_excel(&quot;Link_img_ferplast.xlsx&quot;)
  
  lista = lista.values.tolist()
  lista2 = list(itertools.chain(*lista))
  
  for img in lista2:
      file_name = (img.split('/')[-1])
      print(f&quot;This is the file name: {file_name}&quot;)
  
      r = requests.get(img, stream=True)
  
      if r.status_code == 200:
  
          with open(file_name, 'wb') as f:
              for chunk in r:
                  f.write(chunk)
      else:
  
          broken_images.append(img)
  </code></pre>
  <p>The dataset:
  <a href="https://i.stack.imgur.com/iq23P.png" rel="nofollow noreferrer">Link_img_ferplast.xlsx</a></p>
  <p>I'm also having some issues with the following error:</p>
  <p><strong>line 11, in 
  file_name = (img.split('/')[-1])
  AttributeError: 'float' object has no attribute 'split'</strong></p>
  <p>This is stopping the code, after downloading some images.</p>
  <p>Thanks in advance for all your help!</p>