“Can only join an iterable” python error

前端 未结 2 2036
孤街浪徒
孤街浪徒 2021-02-13 06:26

I\'ve already looked at this post about iterable python errors:

"Can only iterable" Python error

But that was about the error \"cannot assign an iterab

相关标签:
2条回答
  • 2021-02-13 07:16

    splitlist1.reverse(), like many list methods, acts in-place, and therefore returns None. So tobereversedlist1 is therefore None, hence the error.

    You should pass splitlist1 directly:

    splitlist1.reverse()
    reversedlist = ' '.join(splitlist1)
    
    0 讨论(0)
  • 2021-02-13 07:22

    string join must satisfy the connection object to be iterated(list, tuple)

    splitlist1.reverse() returns None, None object not support iteration.

    0 讨论(0)
提交回复
热议问题