Home / Python Strings / How to Format Selected Parts of a String in Python In this example we will show how to format selected parts of a string using the format() method in Python. Source Code print('I love {}!'.format('Python')) Output: I love Python!