How to use 'num2str python' in Python

Every line of 'num2str python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
198def num2str(num):
199 # TODO: i18n...
200 # TODO: this is *UGLY*
201 # TODO: OMG, i'm *so* embarrassed
202 # TODO: but it works... sort of.
203 if num == 0:
204 return '-'
205 s = list(reversed(str(num)))
206 for idx in reversed(range(3, len(s), 3)):
207 s.insert(idx, ',')
208 return ''.join(reversed(s))

Related snippets