Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: How can i call array_length to get the length of array object?

Reply
Thread Tools

Re: How can i call array_length to get the length of array object?

 
 
Ignacio Mondino
Guest
Posts: n/a
 
      06-24-2012
On Sat, Jun 23, 2012 at 11:23 PM, gmspro <(E-Mail Removed)> wrote:
>
> Hi,
>
> I tried this,
> >>> import array
> >>> from array import array
> >>> arr=array('i',[5,7,8])
> >>> arr.sg_length

> Traceback (most recent call last):
> * File "<stdin>", line 1, in <module>
> AttributeError: 'array.array' object has no attribute 'sg_length'
> >>> arr=array('i'[5,8,7])

> Traceback (most recent call last):
> * File "<stdin>", line 1, in <module>
> TypeError: string indices must be integers
> >>> arr=array('i',[5,8,7])
> >>> arr.length

> Traceback (most recent call last):
> * File "<stdin>", line 1, in <module>
> AttributeError: 'array.array' object has no attribute 'length'
> >>> arr.length()

> Traceback (most recent call last):
> * File "<stdin>", line 1, in <module>
> AttributeError: 'array.array' object has no attribute 'length'
> >>> length(arr)

> Traceback (most recent call last):
> * File "<stdin>", line 1, in <module>
> NameError: name 'length' is not defined
> >>> array_length(arr)

> Traceback (most recent call last):
> * File "<stdin>", line 1, in <module>
> NameError: name 'array_length' is not defined
> >>> arr.array_length()

> Traceback (most recent call last):
> * File "<stdin>", line 1, in <module>
> AttributeError: 'array.array' object has no attribute 'array_length'
> >>> arr.array_length

> Traceback (most recent call last):
> * File "<stdin>", line 1, in <module>
> AttributeError: 'array.array' object has no attribute 'array_length'
>
> I'm trying to call this function, http://hg.python.org/cpython/file/3b...ymodule.c#l657
>
> Is that possible to call that function?
>
> I know it's possible to do:
> >>>len(arr)
> >>>arr.itemsize

>
> Any asnwer will be highly appreciated.
>
> Thanks.
>
> --
> http://mail.python.org/mailman/listinfo/python-list


Hi,

something along the lines
>>> s = 'supercalifragilisticexpialidocious'
>>> len(s)

34

check http://docs.python.org/ for more on this.

Ignacio
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Re: How can i call array_length to get the length of array object? Mark Lawrence Python 2 06-25-2012 08:20 PM
Re: How can i call array_length to get the length of array object? Antoon Pardon Python 0 06-25-2012 01:48 PM
Re: How can i call array_length to get the length of array object? Stefan Behnel Python 0 06-24-2012 08:48 AM
Re: How can i call array_length to get the length of array object? Ian Kelly Python 0 06-24-2012 05:34 AM



Advertisments