I am a newbee just started my first language as Python.
I am trying to write code to open multiple encrypted pdf files and save them without password.
All files are in a folder, I have a csv file filePassword.csv with columns filename and password.
But my code is not working. Please guide me on how to solve this error.
import pikepdf as pdf
import pandas as pd
df = pd.read_csv('filePassword.csv')
filename, password = df['filename'], df['password']
for file in filename:
for code in password:
file1 = pdf.open(file,code)
file1.save('1_'+filename)
I get this error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
You can loop over the dataframe
dfusingiterrows()and then accessfilenameandpasswordin following way. There is no need of nested loops.