Example:
regular_string = "%s %s" % ("foo", "bar")
result = {}
result["somekey"] = regular_string,
print result["somekey"]
# ('foo bar',)
Why result["somekey"]
tuple now not string?
Example:
regular_string = "%s %s" % ("foo", "bar")
result = {}
result["somekey"] = regular_string,
print result["somekey"]
# ('foo bar',)
Why result["somekey"]
tuple now not string?
When you write
result["somekey"] = regular_string,
Python reads
result["somekey"] = (regular_string,)
(x,)
is the syntax for a tuple with a single element. Parentheses are assumed. And you really end up putting a tuple, instead of a string there.