[Tutor] Write array to Status text

Stanfield, Vicki {D167~Indianapolis} VICKI.STANFIELD at roche.com
Mon Nov 17 13:09:58 EST 2003


Okay, it looks like an array but when I do this I get an error saying
that:

'list' object has no attribute 'tostring'

So I guess it is really a list. It looks so much like an array in C. I'm
afraid that I don't see the reason for both existing. Is there a place
where I can find out more about the differences? I'm sure that I could
use a real array for what I am doing if I only understood the difference
between arrays and lists.

--vicki


-----Original Message-----
From: Vicki Stanfield [mailto:vicki at thepenguin.org] 
Sent: Friday, November 14, 2003 7:10 PM
To: tutor at python.org
Subject: Re: [Tutor] Write array to Status text


This looks like what I need, but I have to wait until I am in my office
again on Monday to be sure. Thanks.

--vicki
> If your array would really be an array you could use the `tostring' 
> method of arrays.
>
>>>> import array
>>>> arr = array.array('c', "I am an array of characters") arr[0:4]
> array('c', 'I am')
>>>> arr[0:4].tostring()
> 'I am'
>>>>
>
>
>    Karl
> --
> Please do *not* send copies of replies to me.
> I read the list
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org 
> http://mail.python.org/mailman/listinfo/tutor
>


_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list