fork download
  1. import collections
  2. import pickle
  3. x = collections.namedtuple("Fred", ("a", "b"))
  4. y = x(1,2)
  5. z = x(3,4)
  6. s = pickle.dumps([y,z])
  7. print(s)
Runtime error #stdin #stdout #stderr 0.04s 28104KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 6, in <module>
_pickle.PicklingError: Can't pickle <class '__main__.Fred'>: attribute lookup Fred on __main__ failed