file io - Python error: list indices must be integers, not unicode -
there problem: i'm trying numbers tkinter's text widget(get's text file) way: text = self.text_field.get(1.0, 'end') s = re.findall("\d+", text) s returns this: [u'0', u'15', u'320', u'235', u'1', u'1', u'150', u'50', u'2', u'2', u'20'] than try add tags text widget: for in s: self.text_field.tag_add('%s', '5.0', '6.0') %s[i] and gives error: list indices must integers, not unicode thanx helping me :) in python when do for x in l: ... inside body loop x list element, not index. in case correction needed use % i instead of % s[i] . if in other cases need both list element , index number common python idiom is: for index, element in enumerate(l): ...