I'm wrong or Will we fix the ducks limp?
jfine2358 at gmail.com
jfine2358 at gmail.com
Mon Jun 6 10:32:35 EDT 2016
On Friday, June 3, 2016 at 3:20:42 PM UTC+1, Sayth Renshaw wrote:
> pyqFiles = []
> for filename in sorted(file_list):
> pyqFiles = pyqFiles.append(pq(filename=my_dir + filename))
This won't end well. The return value from [].append(...) is None.
>>> [].append(0) is None
True
The first time through the loop pqFiles is set to the return value of pqFile.append(...), which is None.
The second time through, you'll get:
AttributeError: 'NoneType' object has no attribute 'append'
--
Jonathan
More information about the Python-list
mailing list