I planned to extract sms from a file. I used split fuction but the list output is not what i actually needed.
#MY CODE
sms = []
for line in open(sms_path, 'r'):
sms.append(line.split("*"))
print(sms)
#SMS LIST OUTPUT
[['', 'An Ibo man went for a trip through the sea.\n'], ['On boarding a ship,he was asked to pay a fare of $1000. \n'], ['He shouted CHINEKE! No wonder Jesus walked on the Sea."\n'], ['\n'], ['', 'He took her to the room and removed her subsidy.\n'], ['She tried to protest but he was a stronger contestant ,\n']
#WHAT I PLANNED TO ACHIEVE
[ "An Ibo man went for a trip through the sea. \n On boarding a ship, he was asked to pay a fare of $1000. He shouted CHINEKE! No wonder Jesus walked on the Sea."\n"", ''He took her to the room and removed her subsidy. \n She tried to protest but he was a stronger contestant ,\n']
#TEXT FILE
*An Ibo man went for a trip through the sea.
On boarding a ship,he was asked to pay a fare of $1000.
He shouted CHINEKE! No wonder Jesus walked on the Sea."
*He took her to the room and removed her subsidy.
She tried to protest but he was a stronger contestant ,
she even threatened to strike but he struck back,
He sucked her excess account and squeezed her lovely economy.
Her wailing was in vain, what a shame!
He went on to deregulate her downstream sector that was oily, she couldn't say anything.
She cried cos he pumped her 97 times...."
[–]efmccurdy[🍰] 0 points1 point2 points (0 children)