LaTeX Output: How to replace Brackets and add Dollars
I have
x = 1
data = [x/n for n in range (1,4)]
M = latex(data)
print M
print M.replace('\left[', '$').replace(', ', '$, ').replace('\right]', '$')
Out Actual:
\left[1, \frac{1}{2}, $\frac{1}{3}$ \right]
$1$, \frac{1}{2}, $\frac{1}{3}$\right]
But I need:
Out Target:
$1$, $\frac{1}{2}$, $\frac{1}{3}$