Using python, how can I split a file, containing for example a code with methods, variables, etc. into words but leave the code's string variables as one unit string?
For example: given the following python code inside a file:
def example():
a = 5
b = "Hello World"
The result should be:
['def', 'example', '(', ')', ':', 'a', '=', '5', 'b', '=', '"Hello World"']
where "Hello World" is as one single token.
Thanks...