Discussion about this post

User's avatar
Kuldeep sharma's avatar

import csv

fieldname=['Language1','Language2']

with open(r"C:\Users\kulde\Downloads\example1.csv",'a',newline='') as file :

writer=csv.DictWriter(file,fieldnames=fieldname,)

writer.writeheader()

while True:

org_word=input("Enter a word in languahe 1(or type 'done' to finish):")

if org_word.lower() == 'done':

break

else:

trans=input('enter the translation of {} in the language2 :'.format(org_word))

writer.writerow({'Language1':org_word,

'Language2':trans})

print('{}(language1) has been added with the translation : {} (language2)'.format(org_word,trans) )

Expand full comment
Pratik Dave's avatar

This was good one!! Enjoyed the learning..thanks

Expand full comment
4 more comments...

No posts