I am trying to write a basic interpreter in python. So, I am at that point where I am trying to declare whether a string entered in command prompt is a method or variable type.
So not trying any fancy stuff..
s="12345" #variable
s ="foo()" method
s = "foo(1234)" method
What is a robust way to do this (for example.. robust for whitespaces ... throw error if syntax is not proper)
My code is pretty straightforward
s = s.strip()
params= s[s.find("(") + 1:s.find(")")] # find the params..
The above command works in case two and case three but for case 1.. it gives weird results..
paramsto be for'12345'?