Skip to main content

My first Python script

Today i have wrote a python script to fetch the results of
all the students of my class and generate a html file to view the
results.

I have already posted a ruby script which is do the same thing. but
that was not written by me. It was done by Mr. rajkumar. He uses ruby to do that.

I have recently tried to implement my python knowledge so i have write a script
to do the same thing.

I assume that you already know how to run this script

 
#author: manimaran g
#use: script to fetch all the results and give a html file

#!/usr/bin/python

import urllib

url = "http://www.schools9.com/university-of-madras-exam-results0707.aspx?htno="
#this list will store the exam numbers
ex_no=[]
for num in range(495,505):
  ex_no.append('s900'+str(num))
#urlname list used to store the url+exam_number
urlname=[]
for i in range(len(ex_no)):
  urlname.append(url+ex_no[i])

for url in urlname:
  #reading each url in the urlname and read it and store in text
  text=urllib.urlopen(url).read()
  #open results.html file and append the result text
  file=open('results.html','a')
  file.write(text)
  file.close()

programming is fun :)

Comments

Popular posts from this blog

ரிதம்பாக்ஸில் ரேடியோ மிர்ச்சி

உபுண்டு 12.04ல் bansheeயை தூக்கிவிட்டு மறுபடியும் rhythmbox default இசைப்பானாக இடம்பெற்றுள்ளது. ரிதம்பாக்ஸ்ல் bansheeயை விட பல அம்சங்கள் குறைவுதான். ஏன் banshee ஐ எடுத்தார்கள் என்று  சரியாக புரியவில்லை. என்னதான் high-bitrateல் பாடல்கள் இருந்தாலும் fm கேட்பது ஒரு மகிழ்ச்சிதான். சில வருடங்களுக்கு முன்பு எங்கள் தெருக்களில் சூரியன் fm, ரேடியோ மிர்ச்சி போன்றவை தான் என்னை எழுப்பும்.

need your response

It has been a long time... my rest hours are reduced i only sleep for 5 to 6 hours a day.. so i can't post frequently.. sorry friends.. my university is a good place to refine myself. yes..! thoughts about my programming computers are refined there.. i always wanted share my experience.. but i feared of thinking that it will helpful for you or not.. most of us don't like to hear stories of others. so i stopped blogging and of course having less time.. i have earned some good friends there... who are interested in open-source technology.. very few of us only know the linux platform.. this semester mini project also in open softwares like mysql, postgrey sql i will start blogging my experience if you are interested.. regards, Mani G

உபுண்டு டெர்மினலில் இருந்து இலவசமாக sms அனுப்பலாம்

இன்று டெர்மினலில் இருந்து எப்படி இலவசமாக sms அனுப்புவது என்று பார்க்கலாம். way2sms சென்று sms அனுப்புவதற்கு அந்த தளத்தின் விளம்பரங்களை தாண்டிதான் அனுப்ப வேண்டியிருக்கிறது. விளம்பரங்களை பார்க்கமால் சுலபமாக இந்த script ஐ பயன்படுத்தி இலவசமாக sms அனுப்பலாம். இதற்கு முதலில் way2sms ன் பயனராக இருக்க வேண்டும். இல்லை என்றால way2sms.com சென்று ஒரு அக்கவுண்டினை தொடங்கிகொள்ளவும். username, password  வேண்டும்.