Can someone tell me why next code 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 --> indicating 'for'

However I need to put the code on one single line.
When I separate them like below 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