Since you are using python it is going to be really easy for you. You can do it by using the encode method on any string. In the encode method pass the encoding as a parameter such as 'utf-8' or 'utf-16'. Like this:
Check out this python course that will enable you to master python and it's libraries.