Further string manipulation in Python

This post is picking up from the previous entry, examining simple strings and manipulating them within Python.  Previously we looked at a placeholder within a curly bracket:

1a

You can of course use multiple placeholders, and multiple brackets, when you are manipulating strings:

1b.PNG

In this case, the order in which the data is transferred to the placeholder, is determined by where they appear in the format method brackets.  So here you can see two placeholders, {0} and {1} – and the contents of the firstname variable will be transferred into the {0} placeholder; correspondingly the contents of the secondname variable will be transferred into the {1} placeholder.

For a fuller explanation see the video tutorial below:

More manipulation of strings in Python

Happy coding!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s