数组和列表 [英] array and list

查看:85
本文介绍了数组和列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数组和python中的列表有什么区别?

我看到列表中包含C或perl中数组的所有功能。

所以请告诉me.thanks。

what''s the difference between an array and a list in python?
I see list has all features of array in C or perl.
so please tell me.thanks.

推荐答案

" J.彭" < pe ****** @ gmail.comwrites:
"J. Peng" <pe******@gmail.comwrites:

python中数组和列表之间的区别是什么?
what''s the difference between an array and a list in python?



在Python中,''list''是一种基本的内置类型。 Python没有''array''

类型,尽管这个术语通常用于指代数字Python中定义的''array''类型

(不是标准库的一部分,

所以不是Python的一部分。)

In Python, ''list'' is a basic built-in type. Python has no ''array''
type, though that term is often used to refer to the ''array'' type
defined in Numeric Python (which is not part of the standard library,
so not really part of Python).


我看到列表包含C或perl中数组的所有功能。
I see list has all features of array in C or perl.



您可能还想比较和对比Python''list''和''dict''。


- -

\当密码学被取缔时,bayl bhgynjf jvyy unir |

` \ cevinpl。" - 匿名|

_o__)|

Ben Finney

You may also want to compare and constrast Python ''list'' and ''dict''.

--
\ "When cryptography is outlawed, bayl bhgynjf jvyy unir |
`\ cevinpl." -- Anonymous |
_o__) |
Ben Finney


2008年1月18日星期五15:05: 23 +1100,Ben Finney写道:
On Fri, 18 Jan 2008 15:05:23 +1100, Ben Finney wrote:

" J.彭" < pe ****** @ gmail.comwrites:
"J. Peng" <pe******@gmail.comwrites:

>数组和python中的列表有什么区别?
>what''s the difference between an array and a list in python?



在Python中,''list''是一种基本的内置类型。 Python没有''array''类型,

虽然这个术语通常用于指代

Numeric Python中定义的''array''类型(不是标准库的一部分,所以不是真正的部分Python)。


In Python, ''list'' is a basic built-in type. Python has no ''array'' type,
though that term is often used to refer to the ''array'' type defined in
Numeric Python (which is not part of the standard library, so not really
part of Python).



您是否忘记了阵列模块?


Did you forget the array module?


>>导入数组
数组
>>import array
array



< module''数组''from''/usr/lib/python2.5/lib-dynload/arraymodule.so''>

<module ''array'' from ''/usr/lib/python2.5/lib-dynload/arraymodule.so''>


>我看到list具有C或perl中数组的所有功能。
>I see list has all features of array in C or perl.



您可能还想比较和对比Python''list''和''dict''。


You may also want to compare and constrast Python ''list'' and ''dict''.



原始海报可能还想查看交互式解释器中的help()和dir()

函数:


帮助(列表)

dir(列表)

help(数组)

help(array.array )





-

史蒂文

The Original Poster might also like to check out the help() and dir()
functions in the interactive interpreter:

help(list)
dir(list)
help(array)
help(array.array)

etc.


--
Steven


1月18日凌晨3:23,J。彭" < peng .... @ gmail.comwrote:
On Jan 18, 3:23 am, "J. Peng" <peng....@gmail.comwrote:

python中数组和列表之间的区别是什么?

我看到list具有C或perl中数组的所有功能。

所以请告诉我。谢谢。
what''s the difference between an array and a list in python?
I see list has all features of array in C or perl.
so please tell me.thanks.



如果你不熟悉Python,那么其他语言可能会出现在一个

''数组'',Python程序可能会组织数据作为清单。列表比Python中的数组更多地使用
。你应该会在

教程/书籍中找到这种情况。


P.S.如果您了解Perl,请尝试: http:// wiki。 python.org/moin/PerlPhra...ght=%28perl%29

- 帕迪。

If you are new to Python, then where other languages may reach for an
''array'', Python programs might organise data as lists. Lists are used
much more than arrays in Python. you should find that is the case in
tutorials/books too.

P.S. if you know Perl then try: http://wiki.python.org/moin/PerlPhra...ght=%28perl%29
- Paddy.


这篇关于数组和列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆