Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Array
#1
hi Friends,

can you guys give difference between list and array in python?

and give some functions which are used in array and list ?
Reply
#2
list is an array, it can hold combination of mixed values, which makes is very flexable.
x = [1, 2, 3, 4, 'Harry']
to use array, you must import array (and define type), it is 'C' array
example:
from array import array
x = array('l', [1, 2, 3, 4, 5])
array is a function, allows more operations, at the cost of being less easy to use see: https://docs.python.org/3/library/array.html
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020