Python discard extra information

  • From: Storm Dragon <stormdragon2976@xxxxxxxxx>
  • To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 10 Feb 2010 19:55:13 -0500

Hi,
I have written a small program to translate from english to another
language, in this instance, Spanish. The problem is, it returns some
other stuff that I don't need. How can I get just the translated text
witout the other stuff? I only want to use standard libraries and keep
it as short as possible. Thanks for the help. Here's the code:
import urllib
text = "hello, how are you today?"
languageCode = 'es'
newText =
urllib.urlopen("//ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=";
 + urllib.quote(text) + "&langpair=en|" + urllib.quote(languageCode)).read()
print newText

Thanks
Storm


-- 
Follow me on Twitter:
http://www.twitter.com/stormdragon2976
My blog, Thoughts of a Dragon:
http://www.stormdragon.us/
What color dragon are you?
http://quizfarm.com/quizzes/new/alustriel07/what-color-dragon-would-you-be/



Other related posts: