Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83179
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: Put float number in message. |
| Date | 2015-01-03 20:32 +0000 |
| References | <4e62c96c-aa5f-43fd-ba67-c147c5ef0b96@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17358.1420317182.18130.python-list@python.org> (permalink) |
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
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