i want to print "(" in python
print "(" + var + ")"
but it says:
TypeError: coercing to Unicode: need string or buffer, NoneType found
can somebody help me? that cant be too hard... -.-
it appears that var
is None
in what you provided. Everything is correct, but var
does not contain a string.
Try this:
var = 'Hello World!'
print('(' + var + ')')
Also, your code works well on Python 2.7.4
, so long as you pre-define var
.
print "(%s)" % var
?