Thursday, September 15, 2022

[FIXED] How to print brackets in python

Issue

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


Solution

Using string formatting:

foo = 'Hello'
print('({})'.format(foo))


Answered By - aldeb
Answer Checked By - Willingham (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.