Difference between revisions of "Python-datastructures"

From wikipost
Jump to navigationJump to search
Line 13: Line 13:
 
{| style="background-color:#f9f9f9;" cellpadding="10" cellspacing="0" border="1"
 
{| style="background-color:#f9f9f9;" cellpadding="10" cellspacing="0" border="1"
 
|style="background-color:#f2f2f2;"|<b>Name</b>
 
|style="background-color:#f2f2f2;"|<b>Name</b>
|style="background-color:#f2f2f2;"|<b>Example</b>
+
|style="background-color:#f2f2f2;"|<b>Examples</b>
 
|style="background-color:#f2f2f2;"|<b>Details</b>
 
|style="background-color:#f2f2f2;"|<b>Details</b>
 
|-
 
|-
 
|Tuple
 
|Tuple
 
|('January', 'February', 'March', 'April', 'May')
 
|('January', 'February', 'March', 'April', 'May')
 +
(
 
|Once set, values cannot be changed
 
|Once set, values cannot be changed
 
Referenced with index
 
Referenced with index

Revision as of 07:37, 23 December 2020

"In computer science, a data structure is a data organization, management, and storage format that enables efficient access and modification. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data."

-- source: Wikipedia


Python knows how to work with of several types of data structures without the need to import additional libraries. Sometimes you do need to import a library to provide support (e.g. json, csv, sql) but most of these are already available when you have python installed. In rare cases you may need to build or acquire a third-party library for data structure support.


In these pages we mainly look at the most common data structures in python:


Name Examples Details
Tuple ('January', 'February', 'March', 'April', 'May')

(

Once set, values cannot be changed

Referenced with index

List [1, 2, 3, 4, 5] Values can be modified, added, deleted

Referenced with index

Dictionary {'Joe':02079343, 'Alice':010534045, 'Bob':01084523} Values can be modified, added, deleted

Referenced with a key

Array array example details