Answer the question
In order to leave comments, you need to log in
Python. How to implement a search for text in xml starting with certain letters?
Good afternoon!
Thanks in advance to everyone for the hints that help me figure out Python.
I'm trying to implement a text search in xml starting with certain letters.
I work with xml file through element tree.
Source tags in xml:
brn_just_text
msk_just_text
I need to select the text by the first 4 characters, i.e., for example, if the text contains brn_, then I do ...
At the moment I have implemented only a search with a full occurrence of the text like this:
if item.find ('.//Caption').text == 'brn_just_text':
I tried to do this:
if item.find('.//Caption').text.startswith() == 'brn_':
Please tell me how to implement ?
Thanks everyone! Don't kick too hard. newbie and in python and with xml I work in detail for the first time;)
Answer the question
In order to leave comments, you need to log in
It is very bad to refuse to use the search engine. tyts and tyts
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question