自然语言处理python进阶(二)

python字符串的简单使用

namesList = ['Tuffy','Ali','Nysha','Tim' ]
sentence = 'My dog sleeps on sofa'names = ';'.join(namesList)
print(type(names), ':', names)
wordList = sentence.split(' ')
print((type(wordList)), ':', wordList)
additionExample = 'ganehsa' + 'ganesha' + 'ganesha'
multiplicationExample = 'ganesha' * 2
print('Text Additions :', additionExample)
print('Text Multiplication :', multiplicationExample)
str = 'Python NLTK'
print(str[1])
print(str[-3])

使用python读取pdf

from PyPDF2 import PdfFileReaderdef getTextPDF(pdfFileName, password = ''):# 打开pdf_file = open(pdfFileName, 'rb')# 读取read_pdf = PdfFileReader(pdf_file)if password != '':read_pdf.decryp


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部