Data Types

Each variable has a type, which can be the following:

  • One of the six basic data types (see the next section)

  • One of the five standard container types

  • One of the standard callable types

  • One of the two object-oriented types

  • Any Java class or standard object

In this chapter we'll cover the basic types.

The Basic Data Types

Most of the six basic data types in Python are analogous to the basic types in Visual Basic and Java. Here they are:

  • String— sequences of characters

  • Integer— integers (whole numbers)

  • Float— floating-point numbers

  • Long— large integers

  • None— no value

  • Type— type

All of them are built into the system. Unlike in Java, everything in Python is an object, including functions, modules, and types. (We'll get to objects in Chapter 6, which ...

Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.