Noob questions about Python

Furkan Kuru furkankuru at gmail.com
Wed Oct 17 15:44:15 EDT 2007


li.reverse() does not return a list it just changes the list li.

val = 00110 is evaluated in base 8 try without leading 0s



On 10/17/07, Ixiaus <parnell.s at comcast.net> wrote:
>
> I have recently (today) just started learning/playing with Python. So
> far I am excited and impressed (coming from PHP background).
>
> I have a few questions regarding Python behavior...
>
> val = 'string'
> li = list(val)
> print li.reverse()
>
> returns nothing, but,
>
> val = 'string'
> li = list(val)
> li.reverse()
> print li
>
> returns what I want. Why does Python do that?
>
> Also I have been playing around with Binary math and noticed that
> Python treats:
>
> val = 00110
>
> as the integer 72 instead of returning 00110, why does Python do that?
> (and how can I get around it?)
>
> Grateful for any replies!
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Furkan Kuru
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071017/8977914b/attachment.html>


More information about the Python-list mailing list