|
@@ -1,37 +0,0 @@
|
|
|
-#!/usr/bin/env python3
|
|
|
-
|
|
|
-import sys
|
|
|
-
|
|
|
-stdin_list = []
|
|
|
-for line in sys.stdin:
|
|
|
- stdin_list.append(line.rstrip())
|
|
|
-
|
|
|
-def replace_substring_of_list(input_list, pattern, replace_str):
|
|
|
- return [sub.replace(pattern, replace_str) for sub in input_list]
|
|
|
-
|
|
|
-def part(input_list, split_index):
|
|
|
- output_list = []
|
|
|
- for sub in input_list:
|
|
|
- output_list.append((sub.split(",")[split_index]))
|
|
|
- return output_list
|
|
|
-
|
|
|
-def replace_substring_of_list_part(input_list, split_index, pattern, replace_str):
|
|
|
- working_list = []
|
|
|
- for sub in input_list:
|
|
|
- working_list.append((sub.split(",")[split_index]))
|
|
|
-
|
|
|
- working_list = [sub.replace(pattern, replace_str) for sub in working_list]
|
|
|
-
|
|
|
- final_list = []
|
|
|
- for list_item in input_list:
|
|
|
- final_list.append(list_item)
|
|
|
-
|
|
|
- output_list = []
|
|
|
- for i in range(len(input_list)):
|
|
|
- loop_list = input_list[i].split(",")
|
|
|
- loop_list[split_index] = working_list[i]
|
|
|
- seperator_string = ","
|
|
|
- output_list.append(seperator_string.join(loop_list))
|
|
|
- return output_list
|
|
|
-
|
|
|
-print(replace_substring_of_list_part(stdin_list, 0, '4', 'quarter'))
|