How to print list without square brackets in Python

4 Answers

0 votes
lst = ['a', 'b', 'c', 'd']

print(','.join(lst))



'''
run:

a,b,c,d

'''

 



answered Apr 18, 2021 by avibootz
0 votes
lst = ['a', 'b', 'c', 'd']

print(*lst, sep = ',')



'''
run:

a,b,c,d

'''

 



answered Apr 18, 2021 by avibootz
0 votes
lst = ['a', 'b', 'c', 'd']

print(str(lst)[1:-1])



'''
run:

'a', 'b', 'c', 'd'

'''

 



answered Apr 18, 2021 by avibootz
0 votes
lst = ['a', 'b', 'c', 'd']

print("," . join([str(a) for a in lst]))



'''
run:

a,b,c,d

'''

 



answered Apr 18, 2021 by avibootz
...