Printing appropriately based on values retrieved

Nick the Gr33k nikos.gr33k at gmail.com
Sat Nov 2 14:25:43 EDT 2013


for row in newdata:
(host, refs, city, useros, browser, visits, hits, downloads) = row

	if downloads != 'Δεν έχει κατεβάσει ταινία':
		print( '<td><select>' )
		for n, download in enumerate( downloads ):
			if n == 0:
				op_selected = 'selected'
			else:
				op_selected = ''
			print( '<option %s> %s </option>' % (op_selected, download) )
		print( '</select></td>' )
	else:
		print( '<td><center><b><font color=white> 'No downloads yet' </td>' )


The above code is supposed to print a select menu in case it has found 
tha user has downloaded files from my website and if he didn't to just 
print a string 'No downloads yet'.

Unfortunately as i have it, it prints 'No downloads yet' inside a select 
menu giving the impression that the 'No downloads yet' was actually a file.

how should i write it to have the result i want it to be?



More information about the Python-list mailing list