Python:re.search发生故障

时间:2017-10-20 18:19:45

标签: python

尝试使用re.search运行代码时,我收到以下错误:AttributeError:module're'没有属性'search'。

#!/opt/anaconda3/bin/python3

import re

if __name__ == "__main__":
    list_of_strings = ["This is string 1",
                   "This is another string",
                   "Most material here",
                   "Let's give it enough to be interesting",
                   "1 last strings"
                   ]

    print ("\nSearch")
    for x in list_of_strings:
        find = re.search("string(.)", x)
        if find:
            print (x)

enter image description here

0 个答案:

没有答案