Re: locale and for loop on same line

2016-01-23 Thread Bev in TX
According to the documentation, "...simple statements may occur on a single line separated by semicolons." The "for" statement is a compound, not simple, statement. Would it be possible to place your statements in a function and then you would just need to invoke the function? Bev in TX On

locale and for loop on same line

2016-01-23 Thread Ramo
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 separat