I’m testing in Python if certain string contains something as follows
if substr in str:
do_something()
The problem is when substr contains letter with diacritics and other non usual characters.
How would you recommend to do tests with such letters?
thank you
I do not know of any problems specific to diacritics in Python. The following works for me:
Edit:
The matching is exact. If diacritics-insensitive matching is what you want, specify this in your question and see Fredrik’s answer.
Edit2: Yes, for string literals containing non-ascii chars you need to specify the encoding in the source file. Something like this should work: