Python:
with open('t.txt', 'r') as input_file, \
open('cif.txt', 'w') as cif_file, \
open('other.txt', 'w') as other_file:
for char in input_file.read():
if char.isdigit():
cif_file.write(char)
else:
other_file.write(char)
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Python:
with open('t.txt', 'r') as input_file, \
open('cif.txt', 'w') as cif_file, \
open('other.txt', 'w') as other_file:
for char in input_file.read():
if char.isdigit():
cif_file.write(char)
else:
other_file.write(char)