Starting from a base script like:

import webbrowser
url = 'http://www.google.com'

(How can I call the print function to be opened in another terminal?)

What happened? I simply opened google.com but now, I would like to get in the same code the possibility to print out the pages opened in the browser as a normal browsing activity would going on.

I explain better myself script.py I get google.com --- at the same time would be great opening a terminal and printing the URL, and even opening a new tab in terminal would happen : tab0: google.com tab1---yahoo.com, I close tab0 and prints--tab0 closed.

Reference: Urllib2?? something help https://askubuntu.com/questions/338294/output-url-of-open-firefox-tabs-in-terminal

closed as off-topic by Michael Homer, Satō Katsura, Anthon, Jeff Schaller, PM 2Ring Apr 1 '17 at 12:04

  • This question does not appear to be about Unix or Linux within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    I'm voting to close this question as off-topic because at best it is a Python programming question, but it's too unclear to migrate anywhere. – Michael Homer Apr 1 '17 at 4:47
  • The webbrowser module is extremely limited. It's just for opening a URL in a browser, it does NOT give you any way to interact with the page or to get any of the data from that page. If you simply want to fetch the contents of a page, take a look at the excellent 3rd-party Requests module. If you need to interact with the page you may have to use something like Selenium. – PM 2Ring Apr 1 '17 at 12:08