Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created September 6, 2023 15:44
Show Gist options
  • Select an option

  • Save aspose-com-gists/dd833a7cfe50a68d05be202787eaf69f to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/dd833a7cfe50a68d05be202787eaf69f to your computer and use it in GitHub Desktop.
Extract RAR Files in Python
import aspose.zip as az
# Load RAR archive
with az.rar.RarArchive("archive.rar") as archive:
# Extract RAR file
archive.extract_to_directory("extracted_rar")
import aspose.zip as az
# Load RAR archive
with az.rar.RarArchive("archive.rar") as archive:
# Extract the desired file entry
archive.entries[0].extract("extracted_encrypted_file.txt", "password")
import aspose.zip as az
# Load RAR archive
with az.rar.RarArchive("archive.rar") as archive:
# Extract encrypted RAR file
archive.extract_to_directory("extracted_rar", "password")
import aspose.zip as az
# Load RAR archive
with az.rar.RarArchive("archive.rar") as archive:
# Extract the desired file entries
archive.entries[0].extract("extracted_file.txt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment