Hello,
It's probably something obvious to seasoned Python programmers, but I can't figure out why re.findall() returns the wrong number of hits when using the following code :
FWIW, I'm using Python 2.7.14 on Windows.
Thank you.
It's probably something obvious to seasoned Python programmers, but I can't figure out why re.findall() returns the wrong number of hits when using the following code :
import re,sys,locale # Open file f = open('input.gpx', 'r') #OK #strings = re.findall(r'<trk>', f.read()) #BAD! strings = re.findall(r'<trk>.+?</trk>', f.read()) f.close() if strings: #27 instead of 348! print "Number of items : ", len(strings)The file contains some French characters. Could it be that accented characters in the input file are preventing Python from reading the whole file?
FWIW, I'm using Python 2.7.14 on Windows.
Thank you.