Linked Questions

Popular Questions

How to check if line only contains digits?

Asked by At

How can I check whether first line of a file contains only digits?

>> with open("text.txt") as f:
        line = f.readline()

>> line
 '0.23\t5.44\t-4.33\t2.45\t-1.23\n'
>> line.isdigit()
False

Related Questions