The expression Sqrt[3]/2 could not be encoded as a Python literal expression

I want to export a list into python format as follows, but failed:

In[106]:= getSGLatt[#]&/@Range[157,158];
(BasicVectors[#]/.{a->1,b->1,c->1, \[Alpha]->Pi/2,\[Beta]->Pi/2,\[Gamma]->Pi/2} // Transpose)&/@%
ExportString[%,"PythonExpression"]

Out[107]= {{{0, Sqrt[3]/2, 0}, {-1, 1/2, 0}, {0, 0, 1}}, {{0, Sqrt[3]/
2, 0}, {-1, 1/2, 0}, {0, 0, 1}}}

During evaluation of In[106]:= Export::invalidpythonexpr: The expression Sqrt[3]/2 could not be encoded as a Python literal expression.

Out[108]= $Failed

How to fix this problem?

Regards,
Zhao

1 Like