R
R
Ruslan Mordovanech2021-12-01 16:12:50
Python
Ruslan Mordovanech, 2021-12-01 16:12:50

How to implement inexact search?

data1 = [
    {
        "date": "29.11.2021 08:30",
        "judge": " Петро І.І.",
        "forma": "Кс",
        "number": "304/1296/15-к",
        "involved": "Об: Вільчинський  І.Д. ",
        "description": "Зловживання службовим становищем"
    },
    {
        "date": "29.11.2021 08:50",
        "judge": " Василь І.І.",
        "forma": "Кримінальне судочинство",
        "number": "304/418/18",
        "involved": "Об: Булеца С. В.",
        "description": "Привласнення, розтрата майна або заволодіння"
    }
]
for i in data1:
   if i['involved'] == 'Булеца':
     print(i['date'], i['judge'], i['forma'], i['number'], i['involved'], i['description'], sep='\n')


the code finds everything, but when I start searching in sections where there is a lot of text, one of the words does not work,

maybe the code needs to be rewritten?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yrets169, 2021-12-01
@Yrets169

replace the loop with this one and it will work

for i in data1:
   if 'Булеца' in i['involved']:
     print(i['date'], i['judge'], i['forma'], i['number'], i['involved'], i['description'], sep='\n')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question