Created
March 23, 2017 17:12
-
-
Save benosteen/5a35f9b2fc759e115f18c532d1e5560b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some equivalent string formatting things to give you an idea of the basics | |
"I love {favourite} pie, but hate {hated} ones.".format(favourite = "apple", hated = "pear") | |
fruit = {"favourite": "apple", "hated": "pear"} | |
"I love {favourite} pie, but hate {hated} ones.".format(**fruit) | |
fruit = {"favourite": "apple", "hated": "pear"} | |
"I love {favourite} pie, but hate {hated} ones.".format(**fruit) | |
"I love {0} pie, but hate {1} ones.".format("apple", "fruit") | |
Also, there is number possibilities for formatting too (sig figs etc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment