Вы можете использовать
import re
text = "1708220416 bytes total (919445504 bytes free)"
#First match
m = re.search(r'\([^()]*?(\d+)[^()]*\)', text)
if m:
print( m.group(1) )
# => 919445504
# All matches, one number per parentheses
text = "1708220416 bytes total (919445504 bytes free) (345 bytes free)"
print (re.findall(r'\([^()]*?(\d+)[^()]*\)', text))
# => ['919445504', '345']
# All matches, all number per parentheses
text = "1708220416 bytes total (919445504 12345) (345 2345)"
print ([num for x in re.findall(r'\([^()]*\)', text) for num in re.findall(r'\d+', x)])
# => ['919445504', '12345', '345', '2345']
См. Python демо онлайн
Детали шаблона
-
\(
- a (
char [^()]*?
- ноль или более символов, отличных от (
и )
, как можно меньше (\d+)
- Группа захвата 1: 1 или более цифр [^()]*?
- ноль или более символов, отличных от (
и )
как можно больше \)
- )
char