Friday, September 12, 2008

python: tuple with one item

When you want to construct a tuple containing only one item you should write
variable = (1,)
You have to add extra coma after the item. If you forget this coma the item will be returned, not the tuple.
Weird =/

No comments:

Post a Comment