How do I extract all the numbers (integers) from a text file using python?
Question: How do I extract all the numbers (integers) from a text file using python? I
am only using them in the def part to make a function of a button. I should be
able to calculate them after extracting them.


Answer: You could use `re.findall` function.

    
    
    re.findall(r'\d+', string)
    

That is,

    
    
    with open('path/file') as file:
        x = file.read()
        print(re.findall(r'\d+', x))
    

**OR**

    
    
    import re
    l = []
    with open('/path/file') as file:
        for line in file:
            for i in re.findall(r'\d+', line):
                l.append(i)
    
    print(l)
    

`\d+` matches one or more digits.

