O'Reilly logo

Python Essential Reference, Second Edition by David M Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Literals

There are four built-in numeric types: integers, long integers, floating-point numbers, and complex numbers.

A number such as 1234 is interpreted as a decimal integer. To specify octal and hexadecimal integers, precede the value with 0 or 0x, respectively— 0644 or 0x100fea8. Write a long integer using a trailing l (ell) or L character, as in 1234567890L. Unlike integers, which are limited by machine precision, long integers can be of any length (up to the maximum memory of the machine). Numbers such as 123.34 and 1.2334e+02 are interpreted as floating-point numbers. An integer or floating-point number with a trailing j or J, such as 12.34J, is an imaginary number. You can create complex numbers with real and imaginary parts by adding ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required