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))

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to