Printing appropriately based on values retrieved

Nick the Gr33k nikos.gr33k at gmail.com
Sat Nov 2 20:25:34 CET 2013


Στις 2/11/2013 8:25 μμ, ο/η Nick the Gr33k έγραψε:
> 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?


-- 
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>' )
	times = times + 1

if times == 0:
	print( '<td><center><b><font color=white> Δεν έχει κατεβάσει ακόμη 
ταινία! </td>' )

I just tried this this didn't work either :(
Please someone t



More information about the Python-list mailing list