1
我已经阅读了一些其他的计算器答案,并且还没有找到一个令人满意的答案,但它之前已被问过。当我尝试使用PyPDF2来读取pdf文档时,它将句子中的所有单词合并为一个连续的字符串。有没有人想出如何避免这种情况。下面是代码PyPDF2坚持删除所有空格
import PyPDF2
import pandas as pd
import struct as struct
from nltk import word_tokenize
pdfFileObj = open("notes.pdf", 'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
## reading pages fine
print(type(pdfReader.numPages))
## read in the pages
pageObj = pdfReader.getPage(0)
print(pageObj.extractText())
以下
被输出
2)Explanationofthedifferencebetweenprobabilityandstatistics.Theroleofprobability
instatisticaldecisionmaking.ExamplesoftheuseofProbabilityinStatistics.
3)Datasummarization(graphicalandnumerical)
4)Probabilityandrandomvariables