Python Built-in Structured Data Types

Q

Python Built-in Structured Data Types?

✍: FYIcenter.com

A

Python Built-in Structured Data Types are data types provided by the Python interpreter to represent structures of data values:

Here is a list of commonly used Python Built-in Structured Data Types:

  • "str" - String data type for sequences of Unicode characters, which can be expressed as characters enclosed in quotes like: "FYIcenter.com", 'FYIcenter.com', etc.
  • "bytes" - Bytes data type for sequences of bytes, which can be expressed in the format of b'...', where ... is sequence of ASCII characters and escape sequences.
  • "list" - List data type for sequences of any data type values, which can be expressed in the format of [v1, v2, ...], where "v1, v2, ..." is a list of comma separated values.
  • "dict" - Dictionary data type for sets of named values. which can be expressed in the format of {n1:v1, n2:v2, ...} , where "n1:v1, n2:v2, ..." is a list name and value pairs.

You can use the type() function to see the data type of a given structured value expression.

>>> type("FYIcenter.com")
<class 'str'>
>>> type(b'FYIcenter.com\x0A')
<class 'bytes'>
>>> type(["Age", 25])
<class 'list'>
>>> type({"Age":25, "Name":"Joe"})
<class 'dict'>

 

Using Python Built-in Data Types

⇒⇒Python Tutorials

2017-09-12, 110👍, 0💬