It is necessary to take the first element from the list which returns the xpath method. The problem is that the list may be empty and then an exception is raised. How can you suppress it or can etree have a special method that returns either an object or None?

  • empty list means Faulse when checking in if, you can use this - ⷶ ⷩ ⷮ ⷪ ⷩ
  • It is necessary that one line be - Andru
  • You asked a similar question. Stackoverflow.com/questions/758647/… - Sour Sourse
  • No, there is generally talking about something else. There, in the case of None, it was necessary to return an empty list, and here it is necessary to take the first element and, if it is not available, return the default value. This is an analogue of get from the dictionary only by index - Andru
  • "It is necessary that one line be"? one line assignment? - Dmitry Erohin

0