I have a large list which consist of approx 47234 English sentences and there are some emojis in my list. i will use this list to make chatbot, but i want to know that in which format e.g txt or csv or etc that i should store my list in a file, but the problem is that list also contains emojis. What should i do, in which format that i can easily retrieve?
Here is some content of my list:
['hi there', 'Hello!', 'Hi! How are you?', 'Not bad! And You?',
"I'm doing well. Just got engaged to my high school sweetheart.",
'Wowowowow! Congratulations! Is she pretty?',
"She 's pretty cute. She invited me to dinner tonight. ",
'Cool! Have a good time you both! And what is your hobby?',
'I love music! I love Taylor swift. ']
I have tried this:
with open("file.txt", 'w') as output:
for sentence in sentences:
output.write(str(sentence) + '\n')
This code give the error message:
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f642' in position 54: character maps to <undefined>
It seems that this error message is due to emojis.
As i mentioned the length of the list is 47324 so using for loop is not a feasible solution.
Any help would be really appreciated