谭诗琪的作业一

代码


import pdfplumber
import re

with pdfplumber.open('SF2019_English.pdf') as pdf:
    text = pdf.pages[13].extract_text()
allwords = re.findall('[a-zA-Z]+', text)
print('The last word is: \"{}\",\nThe length of the last word is {}'.format(allwords[-6], len(allwords[-6])))
print(x)

结果

结果截图

解释

pdfplumber是一个功能强大的模块