I have this line in my python script:
url = tree.find("//video/products/product/read_only_info/read_only_value[@key='storeURL-GB']")
but sometimes the storeURL-GB key changes the last two country code letters, so I am trying to use something like this, but it doesn't work:
url = tree.find("//video/products/product/read_only_info/read_only_value[@key='storeURL-\.*']")
Any suggestions please?
You should probably try .xpath()
and starts-with()
:
urls = tree.xpath("//video/products/product/read_only_info/read_only_value[starts-with(@key, 'storeURL-')]")
if urls:
url = urls[0]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With