How do I create a Python set with only one element?
Solution 1:
In 2.7 as well as 3.x, you can use:
mySet = {'abc'}
Solution 2:
For example, this easy way:
mySet = set([myString])
In 2.7 as well as 3.x, you can use:
mySet = {'abc'}
For example, this easy way:
mySet = set([myString])