Answers for "python list .split"

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

text = 'geeks for geeks'
  
# Splits at space
print(text.split())
Posted by: Guest on October-26-2021
0

python split list

list = [11, 18, 19, 21]

length = len(list)

middle_index = length // 2

first_half = list[:middle_index]
second_half = list[middle_index:]

print(first_half)
print(second_half)
Posted by: Guest on October-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language