This is a sample Python script.
Press Shift+F10 to execute it or replace it with your code.
Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f’Hi, {name}’) # Press Ctrl+F8 to toggle the breakpoint.
Press the green button in the gutter to run the script.
if name == ‘main’:
print_hi(‘PyCharm’)
See PyCharm help at https://www.jetbrains.com/help/pycharm/
#解密PDF:eg-听力机经
import PyPDF
pdfreader = pyPDF.PdfFileReader(open(‘encrypted.pdf’, ‘rb’))
pdfreader.isencrypted
(Ture or false) #(每个PDF file reader对象都有一个isencrypted属性,if PDF 是加密的,他就是ture, 反之就是false)
pdfReader.decrypt('rosebud')
1
page0bj = pdfReader.getpage(0)
#(如果调用了错误的口令decrypt将会返回0,getpage will fall too)
#(要注意的是decrypt函数只解密了reader的对象,而不是PDF文件)
、