More random python observations from a perl programmer
Tom Christiansen
tchrist at mox.perl.com
Thu Aug 19 15:13:45 EDT 1999
[courtesy cc of this posting mailed to cited author]
In comp.lang.python,
duncan at rcp.co.uk (Duncan Booth) writes:
:However I agree it can be confusing that when you subscript a string you
:get another object of type string.
*Tell me* about it!
>>> s = "fred"
>>> print s[0]
f
>>> print s[0][0]
f
>>> print s[0][0][0]
f
>>> print s[0][0][0][0]
f
>>> print s[0][0][0][0][0]
f
>>> print s[0][0][0][0][0][0]
f
--tom
--
"... my dear old friend. I wish to God there were more automata in the world
like you." - Charles Darwin to T H Huxley, letter, 1882.
More information about the Python-list
mailing list