Answers for "split lists python"

12

python split

>>> '1,2,3'.split(',')
['1', '2', '3']
>>> '1,2,3'.split(',', maxsplit=1)
['1', '2,3']
>>> '1,2,,3,'.split(',')
['1', '2', '', '3', '']
Posted by: Guest on November-18-2020
4

python split list

string = 'this is a python string'
wordList = string.split(' ')
Posted by: Guest on March-26-2020
0

python split list

string = "this is a string" 		# Creates the string
splited_string = string.split(" ")	# Splits the string by spaces
print(splited_string) 				# Prints the list to the console
# Output: ['this', 'is', 'a', 'string']
Posted by: Guest on March-29-2021

Python Answers by Framework

Browse Popular Code Answers by Language