saving . . . saved Converting a tuple to a string has been deleted. Converting a tuple to a string has been hidden .
Converting a tuple to a string
Title
Question
Can we convert a tuple to a string like we do for lists?

Python-3.4.3 Sequence-datatypes 03-04 min 0-10 sec 12-08-20, 6:25 p.m. Mitalidas

Answers:

STuple = (123,  'xy',  'vinay',  'giet')
Slist =  (STuple)
Print("List of element is : ", Slist)

13-08-20, 3:16 p.m. vkumar.mupparaju@gmail.com


def convertTuple(tup):
     str = ' '.join(tup)
      return str
Tuple = ('1','2','3')
str = convertTuple(tup)
Print(str)


13-08-20, 3:23 p.m. vkumar.mupparaju@gmail.com


def convertTuple(tup):
     str =' '.join(tup)
     return str
Tuple = convertTuple(tup)
str = convertTuple(tup)
print(str)
13-08-20, 3:28 p.m. vkumar.mupparaju@gmail.com
Thank you sir. Can we just not simply do so by,
Tuple=('1','2','3')
str=convertTuple(Tuple)
print(str)
The aforementioned code also converts a tuple to a string.
15-08-20, 1:46 p.m. Mitalidas

Login to add comment


Log-in to answer to this question.