Recent Comments

Breaking News
Loading...

Alert

style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-2653565209371687"
data-ad-slot="4940986142">
Monday, 10 February 2014

Opening Number Of Websites Using Python in one Click

11:40


So you just started in python programming, and want to prank your arch nemesis. Here i will teach you how to open any website on his computer using python.

Must Read: .VBS - Notepad Fun Tricks

Step 1:
open notepad and type

import webbrowser

In python the "import" statement is used to add a module to your project. In this case we want to add the webbrowser module.

Step 2:

webbrowser.open('http://SITE HERE!.com')

This is calling the open function on your default web browser. You pass it an url in the form of a string.

Possible usages:
You can add as many websites as you want like show below

webbrowser.open('http://www.Smarttricks.co.nr')
webbrowser.open('http://google.com')
url = "http://smarttricks.co.nr";
webbrowser.open(url)

The complete code will look something like below
import webbrowser
webbrowser.open('http://smarttricks.co.nr')
webbrowser.open('http://google.com')
webbrowser.open('http://yahoo.com')
webbrowser.open('http://facebook.com')

Step 3

Save the file as visus.py
Enjoy pranking your friends and if you wish to learn more programming then check out our article below.

0 comments:

Post a Comment

 
Toggle Footer