Exemple #1
0
def searchByName(L, name, searchCol):
	res = []
	lel = False
	for inner in L:
		#handles the header portion of the list
		if not lel:
			lel = True
			res.append(inner)
			continue
		if name.lower() in inner[searchCol].lower():
			res.append(inner)
	return res


print htmlFuncts.startPage("Searching :)")

form = cgi.FieldStorage()

#this will intially start up, since
#nothing has been queried yet
if len(form) == 0:
	print "<h1>file search</h1>"
	
	#the actual form
	print """
<form method="GET" action="lab12.py">
<br>
Search term: <input name="qString" type="textfield">
<h3>Find by:</h3>
name: <input name="findByName" type="checkbox">
        if mini[2].isdigit() and mini[6].isdigit():
            count += (int(mini[2]) * int(mini[6]))
    return count / float(students)


################## BEGIN HTML STUFF ##################
dataStream = open("SAT.csv", "r")
text = dataStream.read()
dataStream.close()

satData = makeList(text)
appendTotal(satData)

studTot = findStudentTotal(satData)

print htmlFuncts.startPage("SAT things")

print makeTabs(2) + "<h1>" + "Total students: " + str(studTot) + "</h1>"

totAvg = totalAvg(satData, studTot)
print makeTabs(2) + "<h1>" + "Total avg: " + str(totAvg) + "</h1>"

print makeTabs(2) + "<table>"

#satData holds the table of tables
print makeTableBody(satData)

print "</table>"

print htmlFuncts.endPage()
			count += (int(mini[2]) * int(mini[6]))
	return count / float(students)


################## BEGIN HTML STUFF ##################
dataStream = open("SAT.csv", "r")
text = dataStream.read()
dataStream.close()

satData = makeList(text)
appendTotal(satData)

studTot = findStudentTotal(satData)


print htmlFuncts.startPage("SAT things")

print makeTabs(2) + "<h1>" + "Total students: " + str(studTot) + "</h1>"

totAvg = totalAvg(satData, studTot)
print makeTabs(2) + "<h1>" + "Total avg: " + str(totAvg) + "</h1>"

print makeTabs(2) + "<table>"

#satData holds the table of tables
print makeTableBody(satData)

print "</table>"

print htmlFuncts.endPage()
Exemple #4
0
def searchByName(L, name, searchCol):
    res = []
    lel = False
    for inner in L:
        #handles the header portion of the list
        if not lel:
            lel = True
            res.append(inner)
            continue
        if name.lower() in inner[searchCol].lower():
            res.append(inner)
    return res


print htmlFuncts.startPage("Searching :)")

form = cgi.FieldStorage()

#this will intially start up, since
#nothing has been queried yet
if len(form) == 0:
    print "<h1>file search</h1>"

    #the actual form
    print """
<form method="GET" action="lab12.py">
<br>
Search term: <input name="qString" type="textfield">
<h3>Find by:</h3>
name: <input name="findByName" type="checkbox">