Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print brackets in python

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... -.-

like image 511
Sven Fridge Avatar asked Jan 18 '26 05:01

Sven Fridge


1 Answers

Using string formatting:

foo = 'Hello'
print('({})'.format(foo))
like image 171
aldeb Avatar answered Jan 19 '26 20:01

aldeb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!