On 2021-04-17 23:56, Quentin Bock wrote:
I'm trying to take the user input and let them change the target language
or dest
code:
from deep_translator import GoogleTranslator
import googletrans
import sys
language_list = googletrans.LANGUAGES
print(language_list)
feedback = input("Would you like to translate a sentence of your own?
(yes/no)")
if feedback == 'no':
sys.exit()
while feedback == 'yes':
user_choice = input ("Enter a language (the abbreviation or correctly
spelled name of the language): ").lower()
user_sentence = input("Enter a sentence you want translated: ")
user_translation = GoogleTranslator(source='en',
target=user_choice).translate(user_sentence)
print(user_translation)
feedback = input ("Would you like to translate a sentence of your own?
(yes/no)")
if feedback == 'no':
sys.exit()
when ran, this will bring an error saying that your inputted language is
not supported
why is this?
All I can say is that it works for me!
--
https://mail.python.org/mailman/listinfo/python-list