Python long() Function

Python 内置函数Python Built-in Functions


Description

long()This function converts a number or string to a long integer.

Python 3.x has removed thelong()function.

Syntax

long() function syntax:

class long(x, base=10)

Parameters

  • x -- A string or a number.
  • base -- Optional, base number, default is decimal.

Return Value

Returns a long integer.

Examples

The following example demonstrates the usage of long():

>>>long() 0L >>> long(1) 1L >>> long('123') 123L >>> >>>

Python 内置函数Python Built-in Functions

Other Extensions