stri=" ".join(i)TypeError: sequence item 0: expected str instance, NoneType found1个回答
NoneType不能直接进行join
你可以自动跳过None
" ".join([x for x in i if x is not None])或者把None替换成“空”
" ".join(["空" if x is None else x for x in i])SofaSofa数据科学社区DS面试题库 DS面经stri=" ".join(i)TypeError: sequence item 0: expected str instance, NoneType foundNoneType不能直接进行join
你可以自动跳过None
" ".join([x for x in i if x is not None])或者把None替换成“空”
" ".join(["空" if x is None else x for x in i])SofaSofa数据科学社区DS面试题库 DS面经