Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83179

Re: Put float number in message.

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'from:addr:yahoo.co.uk': 0.04; 'newbie': 0.05; 'float': 0.07; 'string': 0.09; 'ascii': 0.09; 'formatting': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:number': 0.09; 'works.': 0.09; 'language.': 0.14; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'substitute': 0.16; 'language': 0.16; 'wrote:': 0.18; 'command': 0.22; 'appears': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'script.': 0.24; 'options': 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'characters': 0.30; "skip:' 10": 0.31; 'anyone': 0.31; 'url:python': 0.33; 'convert': 0.35; 'representing': 0.36; 'url:org': 0.36; 'error.': 0.37; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'called': 0.40; 'numbers': 0.61; 'url:3': 0.61; 'john': 0.61; 'simple': 0.61; 'first': 0.61; 'our': 0.64; 'total': 0.65; 'charset:windows-1252': 0.65; 'here': 0.66; 'characters,': 0.84; 'subject:message.': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Put float number in message.
Date Sat, 03 Jan 2015 20:32:38 +0000
References <4e62c96c-aa5f-43fd-ba67-c147c5ef0b96@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host host-92-24-222-48.ppp.as43234.net
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
In-Reply-To <4e62c96c-aa5f-43fd-ba67-c147c5ef0b96@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17358.1420317182.18130.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1420317182 news.xs4all.nl 2924 [2001:888:2000:d::a6]:56754
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83179

Show key headers only | View raw


On 03/01/2015 19:23, John Culleton wrote:
> Here is my last line in a simple program that is a scribus script.
> end = scribus.messageBox('Book Spine Width', 'dummy', ICON_WARNING, BUTTON_OK)
>
> This works. Now I want to put a float number called S instead of 'dummy'.
> If I just put S in the command I get an error. If I convert S to a string with
> SS = str(S)
> first and then
> and substitute SS for 'dummy' I get what appears to be the ASCII numbers representing the characters, not the characters I want.
>
> I am a total newbie with Python. Anyone have a suggestion? Can I use a print command instead?
>
> John Culleton
>

I think you just want some string formatting so (untested) either

end = scribus.messageBox('Book Spine Width', '{}'.format(S), 
ICON_WARNING, BUTTON_OK)

or

end = scribus.messageBox('Book Spine Width', '%f' % S, ICON_WARNING, 
BUTTON_OK)

For all the formatting options see 
https://docs.python.org/3/library/string.html#string-formatting or 
https://docs.python.org/3/library/stdtypes.html#old-string-formatting 
respectively.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Put float number in message. John Culleton <john@wexfordpress.com> - 2015-01-03 11:23 -0800
  Re: Put float number in message. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-03 20:32 +0000

csiph-web