TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

Νίκος Γκρ33κ nikos.gr33k at gmail.com
Sun May 26 05:12:51 EDT 2013


Τη Κυριακή, 26 Μαΐου 2013 11:23:40 π.μ. UTC+3, ο χρήστης Peter Otten έγραψε:
> Νίκος Γκρ33κ wrote:
> 
> 
> 
> > Hello this is the following snippet that is causing me the error i mention
> 
> > in the Subject:
> 
> 
> 
> > print( "<tr><td><center><a href='http://superhost.gr/?show=log&page=%s'><font color=tomato size=5> %s </a></td>" ) % (url, url)
> 
> 
> 
> Hint (Python 3):
> 
> 
> 
> >>> print("a=%s, b=%s") % (1, 2)
> 
> a=%s, b=%s
> 
> Traceback (most recent call last):
> 
>   File "<stdin>", line 1, in <module>
> 
> TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

> >>> print("a=%s, b=%s" % (1, 2))
> 
> a=1, b=2

Thank you very much Peter, so as it seems in Python 3.3.1 all substitutuons must be nested in print().



More information about the Python-list mailing list