Answers for "python isdigit negative"

2

a.isdigit(): for negatives

>>>'-6'.lstrip('-')
'6'
>>>'-6'.lstrip('-').isdigit()
True
Posted by: Guest on July-30-2020
0

python isdigit negative

def is_digit(n):
    try:
        int(n)
        return True
    except ValueError:
        return  False

if is_digit(question):
   ....
Posted by: Guest on August-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language