Reputation: 1
I want to get the last part of the user agent string, for example: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Qlik
I want to get the last word, in this case, is Qlik, but it can be empty or with a longer word.
how can I do this in python?
Upvotes: 0
Views: 274
Reputation: 108
this maybe help you
a = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Qlik'
a.split(' ')[-1]
## 'Qlik'
Upvotes: 1