On Apr 2, 2015 9:45 AM, "Saran Ahluwalia" <ahlusar.ahluwa...@gmail.com> wrote: > > Good Morning: > > I understand this error message when I run this code. However, I am curious > to know what the most pythonic way is to convert the list to a string? I > use Python 2.7. > > "Traceback (most recent call last): > before = dict([(f, None) for f in os.listdir(dirlist)]) > TypeError: coercing to Unicode: need string or buffer, list found"
I actually do not understand the error. :p In particular, I do not understand the subexpression: os.listdir(dirlist) Can you explain what you are trying to do there? The listdir function only consumes single strings, so this looks like a mistake unless dirlist is a string. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor