How to split string with limited number of splits in Python

1 Answer

0 votes
s = 'python,java,c++,c,swift,c#'

lst = s.split(',', 3)

print(lst)
 

 
 
'''
run:
 
['python', 'java', 'c++', 'c,swift,c#']

'''

 



answered Oct 25, 2020 by avibootz

Related questions

...