19 lines
500 B
Python
19 lines
500 B
Python
import re
|
|
|
|
#Write a program to find all maximum substrings of digits.
|
|
#Return only these substrings separated by spaces in their order.
|
|
#Do use regular expressions.
|
|
|
|
|
|
def liczby_reg(file_path):
|
|
licznik = 0
|
|
with open(file_path, 'r', encoding='utf-8') as file:
|
|
for line in file:
|
|
licznik += 1
|
|
number = (re.findall(r'\d+', line))
|
|
if number:
|
|
print(f"{licznik}: {' '.join(number)}")
|
|
|
|
|
|
file_path = 'TaskD04\simple.in'
|
|
liczby_reg(file_path) |