I am trying to join a python list of strings into a single string with '\n'.join(self.product.features)
that I can save into a file. The list looks like this;
[
"【SIX IN ONE】This digital radio alarm clock combines 6 functions: Digital clock 12/24 Hour Format for checking time; dual alarm clock with individual alarm volume control for awaking you up and you can adjust the alarm volume level; FM radio for listening to news& weather forecast; auto brightness & 3 steps dimmer control for eyes care; USB charging port for mobile device and easy to charge your phone near bedside; 3.5 mm jack (not included) for external audio source.",
"【LARGE BRIGHT DISPLAY】Large 1.4-inch Cyan Blue LED display without any blink makes time easy to read from a far distance, auto brightness & 3 steps dimmer control for eyes caring, auto set the display to a brighter setting in daytime and softer one at night.",
"【AUTO TIME SET】 Once you plugged this radio alarm clock to the AC Outlet, default EST time will be displayed. DST (Daylight Saving Time) will be switching automatically, Simple Time Zone Alignment (Press and hold SET button then adjust the Hour by Tune Up or Down), Backup Battery to maintain Time and Alarm Setting.",
"【SUITABLE FOR HOME&OFFICE】You can place this radio alarm clock on bedside table; Office desk; kitchen; study table or cabinet at sitting room - Need to connect to main power.",
"【30 DAYS MONEY BACK GUARANTEE】Please feel free to contact us if you have any questions on this radio alarm clock and you can buy with confidence at any time thanks to our 30-day money back guarantee."
]
This is my code which attempts to join the string and save it;
txtfile = open(self.productDir + "\\Product Details.txt", "w+")
...
txtfile.write("\n\n")
if (self.product.features and len(self.product.features) > 0):
txtfile.write('\n'.join(self.product.features))
else:
txtfile.write('Has no features')
...
txtfile.close()
But I am getting the error;
UnicodeEncodeError: 'charmap' codec can't encode character '\u3010' in position 0: character maps to <undefined>
I can see that some characters were not able to be decoded I am just not sure how to use it in this case to decode/encode or bypass it.