I have data that looks similar to following:
q = (0,0,0)
I wanted to convert the numeric tuple to a string. Many people on the internet offered a solution that looked like this:
user = 45
permission = (43, 12, 65, 34, 67)
final = "{},'{}'".format(user, ','.join(str(p) for p in permission))
print(final)
Source: Trying to convert a numerical tuple into a string.
Unfortunately, I kept getting an error message that read: TypeError: 'int' object is not callable. So, I tried other solutions like this ','.join(map(str, q)). No avail.
Is there something wrong with my application? Please help. Expected output:
q
"0" "," "0" "," "0"
or the following as string:
0,0,0
','.join(str(x) for x in q)and works with your tuple just fine.45,'43,12,65,34,67'. What would you like the result of that input be?