Python code for Stock Market Information

import urllib.request
import csv

# Get a file-like object for a site.
def cse_link():
f = urllib.request.urlopen("http://www.cse.lk/listedcompanies/overview.htm?d-16544-e=1&6578706f7274=1")
# NOTE: At the interactive Python prompt, you may be prompted for a username
# NOTE: and password here.
# Read from the object, storing the page's contents in 's'.
# Read data decoded to utf-8
s = f.read().decode('utf-8')
# Save 's' data to log.csv file
logfile=open("log.csv",'w')
# log.csv file size
size =logfile.tell()
if size==0:
print ("Nothing found to display If the market status is 'CLOSED'" )
logfile.close()


def csv_read():
filename = "log.csv"
reader = csv.reader(open(filename, "rt"))

no=0

for r in reader:


a=r[0]
g=r[11]
change=r[11]
if change=='(-)':
no +=1
print (no,"Negative Contributors ",a,'contributors as % ',int(no/245*100))
'''if change=='(+)':
no +=1
print (no,"Positive Contributors ",a,'contributors as % ',int(no/245*100))
if change=='':
no +=1

print (no,'','', "No Contributor",a,'contributors as % ',int(no/245*100))'''

#print (a)
#print (f)
cse_link()
csv_read()