I need to delimit the string which has new line in it. How would I achieve it? Please refer below code.
Input:
data = """a,b,c
d,e,f
g,h,i
j,k,l"""
Output desired:
['a,b,c', 'd,e,f', 'g,h,i', 'j,k,l']
I have tried the below approaches:
1. output = data.split('
')
2. output = data.split('/n')
3. output = data.rstrip().split('
')
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…