> > I have a string which is returned by a C extension. > > > > mystring = '(1,2,3)' > > > > HOW can I read the numbers in python ? > > re.findall seems the safest and easiest solution: > > >>> re.findall(r'(\d+)', '(1, 2, 3)') > ['1', '2', '3'] > >>> map(int, re.findall(r'(\d+)', '(1, 2, 3)')) > [1, 2, 3]
'(1,2,3)'.scan(/\d+/).map &:to_i ===> [1, 2, 3] -- [T]he attackers tore off the woman's clothes and raped her until five others arrived.... The new arrivals took turns having sex with her and then sodomized her.... At gunpoint, the assailants forced the mother and son to have sex. www.sun-sentinel.com/local/palm-beach/sfl-flpdunbar0822nbaug22-story.html -- https://mail.python.org/mailman/listinfo/python-list