Vladimir Strycek wrote: > Hi all, > > i have a page which when i download from web by python and put tu > variable have something like: > > <body> > > 119/1157/43/40 > </body> > > neer end ( actualy this is only thing on that page.... + <head stuff> ) > > What i need actualy is to get this values 119/1157/43/40 to > variables...., they are changing allthe time, but they stay numbers and > "/" is always between numbers, they are always 4 > > I tried using re to search for it but without luck :( > > could somebody more experienced with re than me how to do it ? > > something like match = re.match('+/',htmltxt) (in htmltxt is the source > code downloaded from web) <-- example not working ;)
You should use re.search(), not re.match() - match() only looks at the start of the text. Try match = re.search(r'(\d+)/(\d+)/(\d+)/(\d+)') Then match.groups(1, 2, 3, 4) will be a tuple of the string representations of the numbers. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor