On Fri, Sep 3, 2010 at 2:51 PM, David Hutto <[email protected]> wrote: > On Thu, Sep 2, 2010 at 11:05 PM, David Hutto <[email protected]> wrote: >> I just added +'*' to select in re.search(select+'*', str(readfile[:])), >> and it now shows the same in both. >> >> But if you have any input on modifications let me know. >> >> Thanks, >> David >> > > Still a problem. When I use the re.search(select+'*', str(readfile)) > the asterisk for re matches it to any character, so if there are any > letters of the word it matches. > > I would like to match the exact word being sent not just any of the > characters, and the only way is with the exact word nothing following it, > but substituting the string parameter with the word even str(word), it > always shows negative for a match, search or findall. > > So does this have something to do with the extra len on the str(wordfromlist) > as stated in the first email, and if so how do I remove whats there. > > If not, what is the, probably small, thing I'm not doing to the item being > used as the re.search/findall parameter? > > Thanks, > David >
Fixed by rstrip() on item being iterated from dictionary file. re.findall(str.rstrip(select), str(readfile) _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
