“Can only join an iterable” python error

前端 未结 2 2035
孤街浪徒
孤街浪徒 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)
    

提交回复
热议问题