Get word translation from google translate website in Python
📁 Advanced Python Topics, question, example
I have a question like this: what if there is a website translate.google.com (for example). When you want to translate a word, you have to enter it in the field and then it will give you the result. And so I have a question: what if I want to get a translation of some word through google translate, how can I parse it using Python? Please suggest some libraries or articles, because I haven't found any, I would be grateful. )
You can use the ** operator to unpack dictionary values into constructor arguments:
class Foo: def __init__(self, A, B, C): self.A = A self.B = B self.C = Cdictionary = {'B': 5, 'A': 2, 'C': 45}foo = Foo(**dictionary)print(foo.A, foo.B, foo.C)# 2 5 45 Log in to leave an answer