Noob questions about Python

hg hg at nospam.org
Wed Oct 17 23:29:56 EDT 2007


Ixiaus 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!

li.reverse does not return a list but reverses the list itself and return
Noe

0xxx tells python that you work in octal.

hg







More information about the Python-list mailing list