locale and for loop on same line
Ramo
raiwil at gmail.com
Sat Jan 23 05:08:37 EST 2016
Can someone tell me why this doesn't work?
import locale; locale.setlocale(locale.LC_ALL, ""); for i in range(1,20,4): print(locale.format("%2f", i, 1))
It gives an error: SyntaxError: invalid syntax (highlighting the word 'for')
I need this code on one and the same line.
However when I separate them it works fine:
import locale
locale.setlocale(locale.LC_ALL, "")
for i in range(1,20,4):
print(locale.format("%2f", i, 1))
More information about the Python-list
mailing list