Python で
elems = ('ham', 5, 1, 'bird') ",".join(elems)
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-5-cd41c12ae701> in <module>() 1 elems = ('ham', 5, 1, 'bird') ----> 2 ",".join(elems) TypeError: sequence item 1: expected string, int found
という
対処法
[list - Why can’t I join this tuple in Python? - Stack Overflow
stackoverflowでmap
関数使い、str
関数を
e = ('ham', 5, 1, 'bird') ','.join(map(str,e))
'ham,5,1,bird'
以上です。
コメント