Use the new-style format method instead of the old-style % operator, which doesn’t have the centering functionality:
print('{:^24s}'.format("MyString"))
Use the new-style format method instead of the old-style % operator, which doesn’t have the centering functionality:
print('{:^24s}'.format("MyString"))