code_junkie

Why use Jython when you could just use Java?

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