17 Sep
2019
17 Sep
'19
2:41 p.m.
Hi Rupert Welcome to the list, if this is your first time here. You wrote:
aSet = set('a','b','c','bar')
Actually, Python isn't quite like that
aSet = set('a','b','c','bar') TypeError: set expected at most 1 arguments, got 4
I think you meant perhaps
aSet = set(['a','b','c','bar'])
Or I think better
set(['a','b','c','bar']) {'c', 'a', 'b', 'bar'}
I've been using Python for almost 20 years now, and often find myself producing little command line examples like this to check my memory regarding common types. Particularly string formatting and regular expressions. And particularly before posting to a public discussion list. -- Jonathan