I have an input string that has delimiter $$$Field$$$
. The string has some lines. I need return a list of all the items in the string, separated by $$$Field$$$
only.
In the example below I should receive as output ['Food', 'Fried\nChicken', 'Banana']
. However, seems that it is interpreting the new lines as a separator as well, so instead of a list I am getting a table. How can I ignore those new lines, so that I just get a list back?
import pandas as pd
from pandas.compat import StringIO
temp=u"""Food$$$Field$$$Fried
Chicken$$$Field$$$Banana"""
df = pd.read_csv(StringIO(temp), sep='\$\$\$Field\$\$\$',engine='python')
print (df)
The only reason why I am using pandas is because this string is actually a huge .csv file, and I cannot read all this in memory at a time, but a streaming processing would be acceptable.