Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python file get text by regular expression

import re
pattern = re.compile("<(d{4,5})>")

for i, line in enumerate(open('test.txt')):
    for match in re.finditer(pattern, line):
        print 'Found on line %s: %s' % (i+1, match.group())
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #file #text #regular #expression
ADD COMMENT
Topic
Name
7+1 =