Article From:

There are two lines in the file file.txt as follows:

How do I match one and print [“nihao”, “hello”]?

Answer 0:

Get all the contents of the file first, and then regular

p = re.compile('one:(\[.*?\])')
arr = p.findall(content)
print arr[0]

Answer 1:
import re
print'one\:(.*)', s).group(1)

Leave a Reply

Your email address will not be published. Required fields are marked *