попробуйте этот код:
from unidecode import unidecode
def find_contact(contacts):
print('Find contact')
search_name = input('Enter the name: ')
search_name = search_name.strip()
search_name = search_name.lower()
search_name = unidecode(search_name)
all_contacts_name=[]
for key,values in contacts.items():
for contact in values:
name = contact["name"]
name = name.strip()
name = name.lower()
all_contacts_name.append(name)
if search_name in all_contacts_name:
print("this contact exists")
else:
print("this contact does not exisit")
find_contact({"contacts":[{"name":"xxxx"},{"name":"ZOLC"}]})
вывод:
Enter the name: ŻÓŁĆ
this contact exists
Вы можете определить свою собственную функцию elisp, которая изменяет регулярное выражение и затем передает его обратно в emacs. В псевдо-elisp:
(defun my-query-replace-regexp (regexp)
; modify regexp to replace ( with \(, { with \{, etc.
(query-replace-regexp modified-regexp)
)
; rebind C-% to use new regexp function
(global-set-key "\C-%" 'my-query-replace-regexp)