forked from Doggies-Galore/DartAudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyawn.py
27 lines (23 loc) · 839 Bytes
/
yawn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def extract_text(line):
# Split the line by commas
parts = line.split(',')
# Check if there are at least three parts (two commas)
if len(parts) >= 3:
# Return the text between the 2nd and 3rd comma
return parts[2]
else:
return None
def main():
input_file = "stations.txt"
output_file = "brief.txt"
with open(input_file, "r") as infile:
with open(output_file, "w") as outfile:
for line in infile:
# Extract text between the 2nd and 3rd comma
extracted_text = extract_text(line)
if extracted_text:
# Write extracted text to output file
outfile.write(extracted_text.strip() + "\n")
print("Extraction completed. Check 'brief.txt'.")
if __name__ == "__main__":
main()