I am trying to get the number of characters in a SymPy expression, for example:
a = sympify('1/4*x+y+c+1/2')
The number, for example, should be 3
. All I have come up with so far is
a.args.__len__()
However, this also allows for constant factors of 1/4 and 1/2.
Any ideas?
source
to share