I wrote a python program to obtain a string, and found there are images in some string, for example: , or "Siempre en día de la Madre la pasábamos así todos en familia dando mucho cariño a nuestra preciosa madre pero hoy la vamos a pasar solos extrañando a mamá pero siempre llevándola en nuestros corazones❤".
I want to delete theses images from the strings, obtaining only numbers and letters.
And please notice: these string are not only written in English, they may be written in all kinds of languages (for example: Arabic, or Japanese).
My program:
for post_item in group_member_posts_list:
if post_item['post_content']:
post_item_content_str = post_item['post_content']
print("post_item_content_str:" + post_item_content_str)
post_item_content_str = filter(str.isalnum,post_item_content_str)
print("after filter post_item_content_str:" + post_item_content_str )
b = TextBlob(post_item_content_str)
post_item_content_type = b.detect_language()
I tried to use filter function, but it gives errors. And isalnum function can only find English letters.
Could you please tell me how to resolve this problem?