python slit

Solutions on MaxInterview for python slit by the best coders in the world

showing results for - "python slit"
Amanda
15 Sep 2016
1file='/home/folder/subfolder/my_file.txt'
2file_name=file.split('/')[-1].split('.')[0]
Isabell
31 Apr 2019
1text= 'Love thy neighbor'
2
3# splits at space
4print(text.split())
5
6grocery = 'Milk, Chicken, Bread'
7
8# splits at ','
9print(grocery.split(', '))
10
11# Splitting at ':'
12print(grocery.split(':'))