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

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to