title: How to rename the pictures after unzip file with the name based on unzip file's name with python
body: <p>I have zip files in folder A and I want to unzip it and rename the pictures in the unzip file based on the name of the zip files then move it to folder B. But I don't know how to rename it. Please help!</p>
  <p>I have script like this:</p>
  <pre><code>path = r'C:\Users\A'
  path_to_extract = r'C:\Users\B'
  for root, dirs, files in os.walk(path):
      for file in files:
          if '.zip' in str(file):
              file_path = path + '/' + file
              zip_ref = zipfile.ZipFile(file_path, 'r') 
              zip_ref.extractall(path_to_extract)
  </code></pre>