在python中将元组转换为字符串

2024-06-16 14:51:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个元组

tup = ('\x00\x05(^\x9a\xdd\x1c\xb3\xe0T\x00!(\xa8z\xd8', 0, 'ABC', 0, None, None, None, None, None, None, None)

我想把它转换成一个管道分隔的字符串

^{pr2}$

我做了这样的事情,却发现了以下错误

''.join(tup)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: sequence item 1: expected string, int found

Tags: 字符串none管道元组abcx00tupx05