Created
April 9, 2020 03:59
-
-
Save Bundi-py/a52efe90cd3d918dd992e08c1f70d195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
with open('c:/FAJLOVI/Python_School/CodingNomads/dict/dict2.csv', newline = '', encoding = 'utf-8') as csvfile: | |
reader = csv.reader(csvfile) | |
mydict = {rows[0]:rows[1] for rows in reader} | |
#Adding a new Pali word to the Dictionary | |
add_pali = input('To add a new Pali word, type it here: ') | |
add_serbian = input('Now type its meaning in Serbian: ') | |
mydict[add_pali] = [add_serbian] | |
print('Done!') | |
#Search a Pali word in the Dictionary | |
search = input('Search for Pali word: ') | |
print('This Pali word in Serbian means the following: ', mydict[search]) | |
#Correcting a Pali word in the Dictionary | |
error = input('Type Pali word to be corrected: ') | |
correction = input('Type correct version of the Pali word: ') | |
mydict[error] = [correction] | |
print('Corrected!', mydict[correction]) | |
#Writing ne status of the Dictionary | |
with open('dict_new.csv', mode='w', encoding = 'utf-8') as outfile: | |
writer = csv.writer(outfile) | |
writer.writerows(mydict) | |
print("Writing complete") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment