os.walk() ValueError: need more than 1 value to unpack

后端 未结 4 1708
滥情空心
滥情空心 2021-01-05 08:38

Alright, I\'m working with a Bioloid Premium humanoid robot, and Mac OS X will not recognize it. So I wrote a Python script to detect changes in my /dev/ folder because any

4条回答
  •  情话喂你
    2021-01-05 08:38

    You need to iterate over os.walk():

    for root_o, dir_o, files_o in os.walk(top):
    

    or store the iterator first, then loop:

    walker = os.walk(top)
    for root_o, dir_o, files_o in walker:
    

    The return value of the callable is a generator function, and only when you iterate over it (with a for loop or by calling next() on the iterator) does it yield the 3-value tuples.

提交回复
热议问题