- тестов
- заказов и
- примеры
- Tests.txt
- Orders.txt и
- Samples.txt
Код: Выделить всё
# Example usage:
file_path = (r'C:\AH_Output\Tests.txt') # Replace with your actual file path
record_count_test = count_records_in_file(file_path)
print(f"Number of Tests: {record_count_test}")
file_path = (r'C:\AH_Output\Orders.txt') # Replace with your actual file path
record_count_order = count_records_in_file(file_path)
print(f"Number of Orders: {record_count_order}")
file_path = (r'C:\AH_Output\Samples.txt') # Replace with your actual file path
record_count_sample = count_records_in_file(file_path)
print(f"Number of Samples: {record_count_sample}")
Код: Выделить всё
# Write to file:
with open (r'C:\AH_Output\IGW_All.txt','w+') as out_file:
print(f"Number of Tests: {record_count_test}",file=out_file)
with open (r'C:\AH_Output\IGW_All.txt','w+') as out_file:
print(f"Number of Orders: {record_count_order}",file=out_file)
with open (r'C:\AH_Output\IGW_All.txt','w+') as out_file:
print(f"Number of Samples: {record_count_sample}",file=out_file)
Код: Выделить всё
Number of Samples: 139
Подробнее здесь: https://stackoverflow.com/questions/792 ... -to-a-file
Мобильная версия