I usually don't make the quotes part of the format string at all and just use `{0!r}`; then Python will use the appropriate quotes around the string.