On Sat, Jan 23, 2016 at 8:45 PM, Terry Reedy wrote:
> On 1/23/2016 8:58 AM, Chris Angelico wrote:
>> On Sun, Jan 24, 2016 at 12:45 AM, Steven D'Aprano
>> wrote:
>>> [steve@ando ~]$ python -c "for i in range(5):
print 'hello world'
"
>>>
This works also but I thought it was possible to do it easier:
import locale; locale.setlocale(locale.LC_ALL, "");
print('\n'.join(locale.format("%2f", i, 1) for i in range(1,20,4)))
--
https://mail.python.org/mailman/listinfo/python-list
2016-01-23 11:36 GMT+01:00 Marko Rauhamaa :
> rai...@gmail.com:
>
>> 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:
On Sun, Jan 24, 2016 at 12:07 AM, Steven D'Aprano wrote:
> On Sat, 23 Jan 2016 09:02 pm, rai...@gmail.com wrote:
>
>> However I need to put the code on one single line.
>
> Why? Is the Enter key on your keyboard broken?
Maybe it's for a python -c invocation.
ChrisA
--
The reason why I want to have it on onto one line has nothing to do with my
question, "why doesn't it work on one line" :)
But if you want to know it, I use this python code in the commandline of a
texteditor :)
Btw.. thank you all for your help. Very happy with it :)
--
On Sat, 23 Jan 2016 09:02 pm, rai...@gmail.com wrote:
> However I need to put the code on one single line.
Why? Is the Enter key on your keyboard broken?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, 24 Jan 2016 12:19 am, Chris Angelico wrote:
> On Sun, Jan 24, 2016 at 12:07 AM, Steven D'Aprano
> wrote:
>> On Sat, 23 Jan 2016 09:02 pm, rai...@gmail.com wrote:
>>
>>> However I need to put the code on one single line.
>>
>> Why? Is the Enter key on your keyboard
rai...@gmail.com:
> 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
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
On Sun, Jan 24, 2016 at 12:45 AM, Steven D'Aprano wrote:
> On Sun, 24 Jan 2016 12:19 am, Chris Angelico wrote:
>
>> On Sun, Jan 24, 2016 at 12:07 AM, Steven D'Aprano
>> wrote:
>>> On Sat, 23 Jan 2016 09:02 pm, rai...@gmail.com wrote:
>>>
However I
On Sun, Jan 24, 2016 at 1:03 AM, Ramo wrote:
> The reason why I want to have it on onto one line has nothing to do with my
> question, "why doesn't it work on one line" :)
>
> But if you want to know it, I use this python code in the commandline of a
> texteditor :)
Called
On Sun, Jan 24, 2016 at 1:45 PM, Terry Reedy wrote:
> C:\Users\Terry>python -c "for i in range(5):\n\tprint('hello world')"
> File "", line 1
> for i in range(5):\n print('hello world')
> ^
> SyntaxError: unexpected character
On 1/23/2016 8:58 AM, Chris Angelico wrote:
On Sun, Jan 24, 2016 at 12:45 AM, Steven D'Aprano wrote:
On Sun, 24 Jan 2016 12:19 am, Chris Angelico wrote:
On Sun, Jan 24, 2016 at 12:07 AM, Steven D'Aprano
wrote:
On Sat, 23 Jan 2016 09:02 pm,
13 matches
Mail list logo