Skip to content

Instantly share code, notes, and snippets.

@jesusalber1
Last active March 11, 2019 22:46
Show Gist options
  • Save jesusalber1/ba651d3142b338e12e38e29c46ff50d5 to your computer and use it in GitHub Desktop.
Save jesusalber1/ba651d3142b338e12e38e29c46ff50d5 to your computer and use it in GitHub Desktop.
Open all found urls in default browser
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