in Education by
I used the pyhton: for m in regex.findall(r"\X", 'ल्लील्ली', regex.UNICODE): for i in m: print(i, i.encode('unicode-escape')) print('--------') the results show ल्ली has 2 Hindi characters: ल b'\\u0932' ् b'\\u094d' -------- ल b'\\u0932' ी b'\\u0940' -------- it is wrong, actually, ल्ली is one Hindi character. How to get the Hindi character(such as ल्ली) by how many Unicode composed. In short, I want to split 'कृपयाल्ली' to 'कृ','प','या','ल्ली' Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
I am not quite sure if this is correct, being Finnish and not well versed in Hindi, but this would merge characters with any subsequent Unicode Mark characters: import unicodedata def merge_compose(s: str): current = [] for c in s: if current and not unicodedata.category(c).startswith("M"): yield current current = [] current.append(c) if current: yield current for group in merge_compose("कृपयाल्ली"): print(group, len(group), "->", "".join(group)) Output is: ['क', 'ृ'] 2 -> कृ ['प'] 1 -> प ['य', 'ा'] 2 -> या ['ल', '्'] 2 -> ल् ['ल', 'ी'] 2 -> ली If you are a beginner and want to know more about Python the do check out the python for data science

Related questions

0 votes
    This is my code that displays output that I would like to alter: import json from collections import OrderedDict ... find anything. Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    I am trying to make an app that can get the patient's symptoms as inputs and outputs the three most likely ... classes[sortedshit[2]]) Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
0 votes
    please see my code below, example_list = [ ['a','b','c'], ['f','g','h'], ['i','j','k'], ] my_string = ''' ' ... g','h'), ('i','j','k'); Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    I would like to clear the written email and write password grid when a del button is pressed, and then I ... mainloop() EmailPassword() Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    webbrowser.open('https://api.WhatsApp.com/send?phone=number') I want to send WhatsApp messages to numbers without ... in this link. Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    I need to find a way to clear the Listbox for the refresh function which I am making. The function should ... clearing the Listbox) Select the correct answer from above options...
asked Jan 18, 2022 in Education by JackTerrance
0 votes
    The code works fine but the only problem I encountered an error is: bad operand type for unary +: 'str'. This is ... for unary +: 'str' Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me how do I start learning Python for Data Science? Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
0 votes
    I am new to python, I have this code: # columns are [0]title [1]year [2]rating [3]length(min) [4]genre ... make that int into a list? Select the correct answer from above options...
asked Jan 9, 2022 in Education by JackTerrance
0 votes
    Is there any way to split the string if it contains an uppercase letter but not the first letter? For example, ... solution to it? Select the correct answer from above options...
asked Jan 8, 2022 in Education by JackTerrance
0 votes
    Here's the code: ''' file_path = (r'C:\Users\Luka\Desktop\Pyhton exercises\pi_digits.txt') with open( ... file_object: print(line) Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    Do I need coding skills for Data Science using Python? Select the correct answer from above options...
asked Jan 17, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me what should I learn in Python for Data Science? Select the correct answer from above options...
asked Jan 17, 2022 in Education by JackTerrance
0 votes
    Should I learn R or Python for Data Science? Select the correct answer from above options...
asked Jan 17, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me where can I learn Python for Data Science? Select the correct answer from above options...
asked Jan 11, 2022 in Education by JackTerrance
...