从文件和索引中提取

时间:2020-02-05 05:59:08

标签: python python-3.x file extract sentence

我要提取包含任何定义的标点符号的句子

  1. 我不能增加标点符号,但是我需要在任何时候增加它使我出错

2.example:

lookup =',',但我想在里面查找更多内容,例如(?!@ ,.)

lookup = ','
with open('testing_for_tools.txt') as myFile:
    for num, line in enumerate(myFile, 1):
        if lookup in line:
            print('found at line:', num)
            print(line)

输出仅对一个正确,:

found at line: 1
i went to city center, and i bought xbox5 , and some other stuff

found at line: 6
i have to go home, then sleep  ؟

0 个答案:

没有答案
相关问题