1test = float("inf")
2
3In Python 3.5, you can do:
4
5import math
6test = math.inf
1# Defining a positive infinite integer
2positive_infnity = float('inf')
3print('Positive Infinity: ', positive_infnity)
4
5# Defining a negative infinite integer
6negative_infnity = float('-inf')
7print('Negative Infinity: ', negative_infnity)
1# Import math Library
2import math
3
4# Print the positive infinity
5print (math.inf)
6
7# Print the negative infinity
8print (-math.inf)
1# Define Negative infinity number
2ntive_inf = float('-inf')
3print('Negative Infinity: ',ntive_inf)