class forDatas:
def __init__(self):
pass
def str2list(self):
s = 'abcd321'
l = list(s)
print(l)
def str2tuple(self):
s = '123abc'
self.t = tuple(s)
print(self.t, type(self.t))
def tuple2str(self):
ex = ('1', '2', '3', 'a', 'b', 'c')
s = ''.join(self.t)
ex = ''.join(ex)
print(s)
print(ex, type(ex))
ex = (1, 2, 3, 'a', 'b', 'c')
alist = list(ex)
print(alist, type(alist))
tu = tuple(alist)
print(tu, type(tu))
def list2str(self):
alist = [1, 2, 3, 'a', 'b', 'c']
s = ''.join(alist)
print(s)
if __name__ == '__main__':
pj = forDatas()
# pj.str2list() #['a', 'b', 'c', 'd', '3', '2', '1']
# pj.str2tuple() #('1', '2', '3', 'a', 'b', 'c')
pj.tuple2str()
# pj.list2str()