Listing item in input when slash comes in python ?
- Yogesh Kumar
- 03-May-2022
- 0
The split() method is useful in cases like this. You can split first on /, and then split the resulting elements on ,.
line = '1,2,3/4,5,6/7,8,9,10/11'
[x.split(',') for x in line.split('/')]
430 0
7
* Be the first to Make Comment