This loop does not work as expected. It prints all 4 elements (expected 3)
guj = ["बळींचाी", "आठ़वले", "मोठय़ा", "धाांची"]
for y in guj:
for i in y:
x = i.encode("raw_unicode_escape")
if x[:5][-3:] not in [b"090", b"091", b"092", b"093", b"094"]:
break
print(y)
The third word should not be printed because it contains a character having 095 series that is invalid.
# "य़".encode("raw_unicode_escape") # b'\\u095f'
output.txt
बळींचाी
आठ़वले
मोठय़ा
धाांची
expected.txt
बळींचाी
आठ़वले
धाांची