import restrs = ['a=b*c;', 'd=a+2;', 'c=0;', 'b=a;']print([re.findall(r'[_a-z]\w*', x, re.I) for x in strs])
Standard input is empty
[['a', 'b', 'c'], ['d', 'a'], ['c'], ['b', 'a']]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!