import http.client, urllib.request, urllib.parse, urllib.error
def translate(IN, OUT, text):
text = urllib.parse.quote(text)
conn = http.client.HTTPConnection("translate.google.com.tr")
conn.request("GET", "/translate_a/t?client=t&text="+text+"&hl="+IN+"&tl="+OUT)
res = conn.getresponse().read().decode("cp1254",'replace')
print(res)
b1 = res.split("],[")
b2 = b1[0].strip('[]')
b3 = b2.strip('","')
b4 = b3.split('","')
return b4[0]
string = input("Turkish >>> English: ")
result = translate("tr","en",string)
print(string,">>>",result)
import http.client, urllib.request, urllib.pars