Boštjan Mejak <bostjan.me...@gmail.com> added the comment:

Please respond...

On Wed, Oct 20, 2010 at 7:05 PM, Boštjan Mejak <rep...@bugs.python.org>wrote:

>
> Boštjan Mejak <bostjan.me...@gmail.com> added the comment:
>
> Thank you so much for your answer. The
> locale.setlocale(category=locale.LC_NUMERIC,
> locale="Slovenian")  works like a charm in my application. Now the 'n'
> format specifier works as I want. But tell me whether the 'n' format
> specifier can be forced to round the float to just one decimal place. I
> know
> that the 'f' format specifier does that by specifying ".1f", but 'f' is not
> locale-aware. I have set the 'n' format specifier in my application like
> ".3n", which is okay if the returned number is two integers and one
> decimal,
> but is not okay if the returned number is one integer and two decimals,
> because I want just one decimal, always. How can I make that by using the
> 'n' format specifier?
>
> On Wed, Oct 20, 2010 at 11:37 AM, Tim Golden <rep...@bugs.python.org>
> wrote:
>
> >
> > Tim Golden <m...@timgolden.me.uk> added the comment:
> >
> > Boštjan, the code segment you quote is the *fallback* if the
> > C module hasn't been built for some reason. The module simply
> > calls through to the underlying C Library. I notice you're
> > running on Windows, so this is a useful MS page:
> >
> > http://msdn.microsoft.com/en-us/library/x99tb11d%28VS.71%29.aspx
> >
> > and you can see there that a call of setlocale (LC_ALL, "English")
> > is valid (of "French" if you prefer):
> >
> > Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit
> > (Intel)] on win32
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import locale
> > >>> locale.setlocale (locale.LC_ALL, "French")
> > 'French_France.1252'
> > >>>
> >
> > ----------
> > nosy: +tim.golden
> >
> > _______________________________________
> > Python tracker <rep...@bugs.python.org>
> > <http://bugs.python.org/issue10092>
> > _______________________________________
> >
>
> ----------
> Added file: http://bugs.python.org/file19306/unnamed
>
> _______________________________________
> Python tracker <rep...@bugs.python.org>
> <http://bugs.python.org/issue10092>
> _______________________________________
>

----------
Added file: http://bugs.python.org/file19316/unnamed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10092>
_______________________________________
Please respond...<br><br><div class="gmail_quote">On Wed, Oct 20, 2010 at 7:05 
PM, Boštjan Mejak <span dir="ltr">&lt;<a 
href="mailto:rep...@bugs.python.org";>rep...@bugs.python.org</a>&gt;</span> 
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 
.8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Boštjan Mejak &lt;<a 
href="mailto:bostjan.me...@gmail.com";>bostjan.me...@gmail.com</a>&gt; added the 
comment:<br>
<div class="im"><br>
Thank you so much for your answer. The<br>
locale.setlocale(category=locale.LC_NUMERIC,<br>
locale=&quot;Slovenian&quot;)  works like a charm in my application. Now the 
&#39;n&#39;<br>
format specifier works as I want. But tell me whether the &#39;n&#39; format<br>
specifier can be forced to round the float to just one decimal place. I know<br>
that the &#39;f&#39; format specifier does that by specifying &quot;.1f&quot;, 
but &#39;f&#39; is not<br>
locale-aware. I have set the &#39;n&#39; format specifier in my application 
like<br>
&quot;.3n&quot;, which is okay if the returned number is two integers and one 
decimal,<br>
but is not okay if the returned number is one integer and two decimals,<br>
because I want just one decimal, always. How can I make that by using the<br>
&#39;n&#39; format specifier?<br>
<br>
On Wed, Oct 20, 2010 at 11:37 AM, Tim Golden &lt;<a 
href="mailto:rep...@bugs.python.org";>rep...@bugs.python.org</a>&gt; wrote:<br>
<br>
&gt;<br>
</div><div class="im">&gt; Tim Golden &lt;<a 
href="mailto:m...@timgolden.me.uk";>m...@timgolden.me.uk</a>&gt; added the 
comment:<br>
&gt;<br>
</div>&gt; Boštjan, the code segment you quote is the *fallback* if the<br>
<div><div></div><div class="h5">&gt; C module hasn&#39;t been built for some 
reason. The module simply<br>
&gt; calls through to the underlying C Library. I notice you&#39;re<br>
&gt; running on Windows, so this is a useful MS page:<br>
&gt;<br>
&gt; <a href="http://msdn.microsoft.com/en-us/library/x99tb11d%28VS.71%29.aspx"; 
target="_blank">http://msdn.microsoft.com/en-us/library/x99tb11d%28VS.71%29.aspx</a><br>
&gt;<br>
&gt; and you can see there that a call of setlocale (LC_ALL, 
&quot;English&quot;)<br>
&gt; is valid (of &quot;French&quot; if you prefer):<br>
&gt;<br>
&gt; Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit<br>
&gt; (Intel)] on win32<br>
&gt; Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or 
&quot;license&quot; for more information.<br>
&gt; &gt;&gt;&gt; import locale<br>
&gt; &gt;&gt;&gt; locale.setlocale (locale.LC_ALL, &quot;French&quot;)<br>
&gt; &#39;French_France.1252&#39;<br>
&gt; &gt;&gt;&gt;<br>
&gt;<br>
&gt; ----------<br>
&gt; nosy: +tim.golden<br>
&gt;<br>
&gt; _______________________________________<br>
&gt; Python tracker &lt;<a 
href="mailto:rep...@bugs.python.org";>rep...@bugs.python.org</a>&gt;<br>
&gt; &lt;<a href="http://bugs.python.org/issue10092"; 
target="_blank">http://bugs.python.org/issue10092</a>&gt;<br>
&gt; _______________________________________<br>
&gt;<br>
<br>
</div></div>----------<br>
Added file: <a href="http://bugs.python.org/file19306/unnamed"; 
target="_blank">http://bugs.python.org/file19306/unnamed</a><br>
<div><div></div><div class="h5"><br>
_______________________________________<br>
Python tracker &lt;<a 
href="mailto:rep...@bugs.python.org";>rep...@bugs.python.org</a>&gt;<br>
&lt;<a href="http://bugs.python.org/issue10092"; 
target="_blank">http://bugs.python.org/issue10092</a>&gt;<br>
_______________________________________</div></div></blockquote></div><br>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to