col_list = ['FLIGHT_DATE\tFLIGHT\tDEP_AIRPORT\tARR_AIRPORT\tSALABLE_SEAT\tRES_PAX_CNT\tADULT_PAX_CNT\tCHILD_PAX_CNT\tBOARD_PAX_CNT']
I'd like to split this up by \t.
What I did was
[i.split('\t') for i in col_list]
[['FLIGHT_DATE', 'FLIGHT', 'DEP_AIRPORT', 'ARR_AIRPORT', 'SALABLE_SEAT', 'RES_PAX_CNT', 'ADULT_PAX_CNT', 'CHILD_PAX_CNT', 'BOARD_PAX_CNT']]
It's an index, but the list goes in duplicate. Is there any way to do the list without duplication?
list split
Split breaks the string and returns it to the list.
sc = col_list[0].split('\t')
print(sc)
>> ['FLIGHT_DATE', 'FLIGHT', 'DEP_AIRPORT', 'ARR_AIRPORT', 'SALABLE_SEAT', 'RES_PAX_CNT', 'ADULT_PAX_CNT', 'CHILD_PAX_CNT', 'BOARD_PAX_CNT']
© 2025 OneMinuteCode. All rights reserved.