Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24379 > unrolled thread
| Started by | Ignacio Mondino <ignacio.mondino@gmail.com> |
|---|---|
| First post | 2012-06-24 00:34 -0300 |
| Last post | 2012-06-24 00:34 -0300 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How can i call array_length to get the length of array object? Ignacio Mondino <ignacio.mondino@gmail.com> - 2012-06-24 00:34 -0300
| From | Ignacio Mondino <ignacio.mondino@gmail.com> |
|---|---|
| Date | 2012-06-24 00:34 -0300 |
| Subject | Re: How can i call array_length to get the length of array object? |
| Message-ID | <mailman.1437.1340508871.4697.python-list@python.org> |
On Sat, Jun 23, 2012 at 11:23 PM, gmspro <gmspro@yahoo.com> 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/3b7230997425/Modules/arraymodule.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
Back to top | Article view | comp.lang.python
csiph-web