On Fri, Jun 02, 2006 at 10:26:28AM +0200, Laurent Pointal wrote:
> A.M a ?crit :
> > Hi,
> >
> >
> >
> > I am trying to find the equivalent functions such as vb's str or asc in
> > Python. Is there any resource that help me to find these kinds of functions
> > in Python faster?
>
>
>
> I'v
A.M a écrit :
> Hi,
>
>
>
> I am trying to find the equivalent functions such as vb's str or asc in
> Python. Is there any resource that help me to find these kinds of functions
> in Python faster?
I've written the PQRC for that purpose:
http://www.limsi.fr/Individu/pointal/python/pqrc/
Metalone wrote:
>
> This might be a little too tricky.
> [" %d", "%d][n < 0] % n --> selects list[0] or list[1] based upon sign
> of number
>
("%+d" % 123).replace("+", " ") is slightly longer but instantly
comprehensible, although I for one think your boolean indexing trick is
cool.
--Max
Slight correction.
" %d" % 123 is not quite equivalent to str(123) as it does not handle
negative numbers the same way.
I am not sure there is a simple direct equivalent.
"%+d" % 123 --> "+123" always gives a sign.
"%4d" % 123 --> " 123"
"%4d" % -123 --> "-123" so this works if you you know how wi
A.M wrote:
> I am trying to find the equivalent functions such as vb's str or asc in
> Python. Is there any resource that help me to find these kinds of functions
> in Python faster?
The Library Reference has a section on built-in functions:
http://docs.python.org/lib/built-in-funcs.html
Also
A.M wrote:
> Hi,
>
>
>
> I am trying to find the equivalent functions such as vb's str or asc in
> Python. Is there any resource that help me to find these kinds of functions
> in Python faster?
>
>
>
> Thank you,
>
> Alan
>
> Alan
Python has a str() function that is close to vb's str. The Pyth