For achieving your result, you have to work with the new-style format function instead of the old-style % operator, which doesn't have the centering property:
print('{:^24s}'.format("MyString"))
If you are a total beginner and wish to learn Python, then do check out the below python tutorial video for better understanding: