In IPython you can use
%precision %.4g
this will print floating point values who's absolute value is < 1e-4 or >= 1e4 in scientific notation.
You can find more information about the %precision
command in the IPython API Docs.
For string formatting options have a look at the Python Docs