script fichiers binaires lecture écriture
onurb at xiludom.gro
Thu Jun 30 12:26:02 CEST 2005
> In English:
> I don't know much about python and I won't have much time to learn much
> about it even if it seems powerful...
> Here is an error I get trying to run this script:
> AttributeError: 'string' object has no attribute 'index'
> According to me, index() is a method of the string class but not an
> attribute. So I don't understand the error message.
In Python, functions are first class citizens (a function is an object
you can bind to a variable, pass as an argument, return from another
function etc...), so methods *are* actually attributes...
> Be aware that I'm
> using pyhton 1.5,
Err... latest is 2.4.1, and the language has really, really changed. You
should consider upgrading...
BTW, in 1.5.x, you can use the String module instead of string class
s = "allo"
but really, consider upgrading to a newer version...
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list