I am using the namedtuple with the collections. i am getting this error
NameError: name collections is not defined.
I am using Python v 3.3.2. Any help would be very appreciated
[for Example] I am getting error on this line
Sale = collection.namedtuple("Sale","productid custerid date price")
Did you import collections
module? The module name is collections
, not collection
.
>>> Sale = collection.namedtuple("Sale","productid custerid date price")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'collection' is not defined
>>>
>>> import collection
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named collection
>>>
>>> import collections
>>> Sale = collections.namedtuple("Sale","productid custerid date price")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With