Search code examples
pythonpyephem

Getting PyEphem to return angles with sign


How do I get PyEphem to give angles with sign and a zero padded to degrees. Currently it returns 2:46:32.8 but I want it in the form +02:46:32.8. Now, I could define a function to return it in that form, but I was wondering if there was a simpler way.


Solution

  • No, the underlying C code inside of libastro does not support leading plus signs or leading zeros. You will have to write a little Python function of your own to add them.