I’m getting desired a result when I run a python script on spyder ipython console but a different unexpected result on the command line console

  cmd, ipython, python
    x,y = symbols('x y')
    integral = x*log(x) + cos(6*x)
    text_exp = sympify(integral)
    exp = sympify(integrate(text_exp, x)) 
    lhs =  "ans"
    prt = clawer(lhs,exp)
    print('Class type:' ,type(prt))

Unexpected output on the command line

Desired Output on spider

I’m trying to split long latex expressions and equations to new lines.Unfortunately the result I’m getting on the command line has unnecessary added strings ,but a desired output on spyder ipython console.May you explain what’s causing the difference in output , given that the the variable prt is just a string ?

Source: Python Questions