Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Following Links in Python

import urllib
from BeautifulSoup import *

URL = raw_input("Enter the URL:") #Enter main URL
link_line = int(raw_input("Enter position:")) - 1 #The position of link relative to first link
count = int(raw_input("Enter count:")) #The number of times to be repeated

while count >= 0:
    html = urllib.urlopen(URL).read()
    soup = BeautifulSoup(html)
    tags = soup('a')
    print URL
    URL = tags[link_line].get("href", None)
    count = count - 1
Comment

PREVIOUS NEXT
Code Example
Python :: Reverse an string Using Reversed 
Python :: rezise object pygame 
Python :: Display vowels in a string using for loop 
Python :: compare list and dataframe in pandas 
Python :: python program to find sqaure root of the number 
Python :: c is better than python 
Python :: restricting user access to web pages 
Python :: pandas merge_asof direction 
Python :: manifest.in python 
Python :: code error correction 
Python :: make row readonly tablewidget pyqt 
Python :: light fm cold start problem 
Python :: file = Root() path = file.fileDialog() print("PATH = ", path) 
Python :: how to add twoo segmen time series in a single plot 
Python :: Create a python for loop that sums the numbers from 100 to 200 
Python :: command to update pip 
Shell :: Could not find the implementation for builder @angular-devkit/build-angular:dev-server 
Shell :: check nginx status 
Shell :: docker install nano 
Shell :: error gyp ERR! stack Error: not found: make 
Shell :: install imutils 
Shell :: stop a process running on a port ubuntu 
Shell :: rust change to nightly 
Shell :: windows flush dns 
Shell :: enable ufw ubuntu 
Shell :: Ultimate Perfomance command 
Shell :: kill port linux 
Shell :: linux check graphics driver 
Shell :: uninstall 4k video downloader ubuntu 
Shell :: how to git commit without message 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =