Skip to content
Advertisement

tokenize in python3.x

I have following codes in python2.x:

JavaScript

Now problem is that in python3.x second argument does not exist. I need to call the function operations.eat() before tokenize. How can we perform the above task in python3.x. One idea is to directly call the function tokenize.eat() before ‘tokenize’ statement(last line of the code). But I am not sure about the arguments to be passed. I’m sure there must be better ways to do it.

Advertisement

Answer

Accoring to http://docs.python.org/py3k/library/tokenize.html, you should now use tokenize.tokenize(readline):

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement