How to explicitly set a boundary condition

The question is fairly generic, and with very little context it is hard to give you any other guidance than suggesting you to look through the demos:
https://fenicsproject.org/olddocs/dolfin/latest/python/demos.html
Please also read: Read before posting: How do I get my question answered? - #4 by nate
before posting further questions