re search through a text Vs line
Shiva
shivaji_tn at yahoo.com
Sun Oct 5 05:36:53 EDT 2014
More information about the Python-list mailing list
Sun Oct 5 05:36:53 EDT 2014
- Previous message (by thread): How donwnload youtube videos?
- Next message (by thread): re search through a text Vs line
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I am doing a regular expression search for a year through a file.
fileextract = open(fullfilename,'r')
line = fileextract.read()
texts = re.search(r'1\d\d\d', line)
print(texts.group())
The above works.
However if I do:
fileextract = open(fullfilename,'r')
line = fileextract.readlines()
for l in line:
texts = re.search(r'1\d\d\d', line)
print(texts.group())
None is returned. Why is it not iterating through each line of the file and
doing a search? - It seems to return none.
Thanks,
Shiva
- Previous message (by thread): How donwnload youtube videos?
- Next message (by thread): re search through a text Vs line
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list