small string split prob

Fredrik Lundh fredrik at pythonware.com
Sun May 12 16:11:28 EDT 2002


"ian" wrote:

> The RCPTTO contains a line read from a socket.
> when i try to split an e-mail address into the box and domain sub parts i
> get a type error on index!?
>
> #split e-mail address
> index = RCPTTO.find("@")
> box = RCPTTO[0,index]
> domain = RCPTTO[index + 1,RCPTTO.len()]

there seems to be quite a few typos in your python book.
try this instead:

    index = RCPTTO.find("@")
    box = RCPTTO[:index]
    domain = RCPTTO[index+1:]

</F>





More information about the Python-list mailing list