Search code examples
pythonpdfasciiencodepypdf

PyPdf python encode method


text = getPDFContent(path).encode("ascii", "ignore")

This is my actual code. Can anyone tell me what does ignore do? And if there's an another parameter for don't copy non-ascii chars? (I copied the function. It is used to get the contents of a pdf) Thanks


Solution

  • Did you look at the documentation? The second argument to the encode method on a string object indicates how errors are handled.