[wxPython] converting Strings

I also had to wade deeply into the Python documentation to figure this out.
The tutorial was helpful as far as it goes, but I found the int(), float()
etc hard to find.

I still would like to know how to set the number of decimals, equivalent to
say the VB format(Float_Var,"0.000") expression. Anyone out there have a
solution?

Regards

Lynndon Harnell

···

-----Original Message-----
From: Mikhael Loo [mailto:mikhael@lib-sys.com]
Sent: Tuesday, 17 July 2001 6:52
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] converting Strings

At one point a while back I read through the Python Tutorial. When I try to
reference it for what I think I remembered for basic stuff like this I get
really stressed out and end up spending a lot of time with it. I'm still
not sure where to look to find these conversion functions. I wish I did.

Chapter 3 of the tutorial seems to cover Numbers, Strings, Unicode Strings,
and Lists but I don't see mention of int(), float(), str(), etc...

The global modul index does not list any of these functions in it's main
listing. I looked under the Strings module but these are not mentioned
there either.

wxPython documentation is a dead end in this case because some wxWindows
functionality is missing from wxPython and there are no wxPython notes to
tell me this is the case. I worked on wxString for quite a while trying to
get it to work before I realized that it wouldn't. I wish there was a list
some where that detailed which things in the wxPython/wxWindows help file
are implemented and which are not. I'm still waiting to find out about
wxMetafile.

This newsgroup has been a real life saver for me in trying to figure out all
of this stuff. A huge sigh of relief when it come to finding out details.
I'm almost finished with the first stage of my project thanks to this group.

  -Mikhael

----- Original Message -----
From: "Patricia Hawkins" <phawkins@connact.com>
To: <wxpython-users@lists.wxwindows.org>
Sent: Monday, July 16, 2001 3:37 PM
Subject: Re: [wxPython] converting Strings

> Thanks thats working for me. How do you reverse this to go from a

float or

> int back to a string again?

str(number)

Perhaps you want to spend some time browsing the python tutorial:
http://www.python.org/doc/current/tut/tut.html

and other Python documentation is available here:
Our Documentation | Python.org

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

"Harnell, Lynndon" wrote:

I also had to wade deeply into the Python documentation to figure this out.
The tutorial was helpful as far as it goes, but I found the int(), float()
etc hard to find.

The built-in type-conversion functions are documented in section 2.3
(`Built-in Functions') of the library reference:
http://www.python.org/doc/current/lib/built-in-funcs.html

I still would like to know how to set the number of decimals, equivalent to
say the VB format(Float_Var,"0.000") expression. Anyone out there have a
solution?

You use the `%' operator.
See http://www.python.org/doc/current/tut/node9.html