code_junkie

Why do you like Python?

Nov 11th, 2011
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. itertools
  2.  
  3. import java.net.*;
  4. import java.io.*;
  5.  
  6. public class JGet {
  7. public static void main (String[] args) throws IOException {
  8. try {
  9. URL url = new URL("http://www.google.com");
  10.  
  11. BufferedReader in =
  12. new BufferedReader(new InputStreamReader(url.openStream()));
  13. String str;
  14.  
  15. while ((str = in.readLine()) != null) {
  16. System.out.println(str);
  17. }
  18.  
  19. in.close();
  20. }
  21. catch (MalformedURLException e) {}
  22. catch (IOException e) {}
  23. }
  24. }
  25.  
  26. import urllib
  27. print urllib.urlopen('http://www.google.com').read()
Add Comment
Please, Sign In to add comment