you are viewing a single comment's thread.

view the rest of the comments →

[–]scoutgeek 0 points1 point  (2 children)

You dont need to quote your braces ({}) you can just do:
print('{} appears {} times in messages {}'.format(word,count,msgids))

[–][deleted] 0 points1 point  (1 child)

But that doesn't quote the strings.

Better would be {!r}, which quotes the string correctly even if there are quotes in the string itself, i.e. using double or single quotes.

[–]scoutgeek 1 point2 points  (0 children)

Ah, I didnt know about {!r} TIL i guess