Last active
March 11, 2019 22:46
-
-
Save jesusalber1/ba651d3142b338e12e38e29c46ff50d5 to your computer and use it in GitHub Desktop.
Open all found urls in default browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import webbrowser | |
text = """ | |
Text with urls goes here. Let's open Google at https://google.com | |
""" | |
urls = re.findall('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', text) | |
for url in urls: | |
webbrowser.open(url) | |
#webbrowser.get('safari').open(url) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment