I extract javascript code from PDF, but it is converted octal escape sequences.
I want to convert it to normal JavaScript code.
\\040\\040\\040\\040\
You can use unicode_escape encoding:
In Python 2.x:
>>> r'\040\040\040\040\146\165\156\143\164\151\157\156'.decode('unicode-escape') u' function'
In Python 3.x:
>>> br'\040\040\040\040\146\165\156\143\164\151\157\156'.decode('unicode-escape') ' function'