文字列配列ではなくオブジェクト配列のPython string.join(list)
Pythonでは、次のことができます。 >>> list = ['a', 'b', 'c'] >>> ', '.join(list) 'a, b, c' オブジェクトのリストがあるときに同じことをする簡単な方法はありますか? >>> class Obj: ... def __str__(self): ... return 'name' ... >>> list = [Obj(), Obj(), Obj()] >>> ', '.join(list) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: sequence item 0: expected string, …