File size: 775 Bytes
f918b3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Open the original file for reading
with open('english_basque_dictionary.txt', 'r', encoding='utf-8') as file:
    lines = file.readlines()

# Create two new files for writing
with open('dictionary.en-eu.en', 'w', encoding='utf-8') as english_file, \
     open('dictionary.en-eu.eu', 'w', encoding='utf-8') as basque_file:
    
    # Iterate through each line in the original file
    for line in lines:
        # Split the line into English word and Basque translation
        english, basque = line.strip().split('\t')
        
        # Write the English word to the English file
        english_file.write(english + '\n')
        
        # Write the Basque translation to the Basque file
        basque_file.write(basque + '\n')

print("Files separated successfully!")