How to use the .split() method to select multiple words?

Hello,

I’m using this snippet of code:
state_attr(trigger.entity_id, 'friendly_name')
which returns:
Balcony Door Contact

If I use:
state_attr(trigger.entity_id, 'friendly_name').split()[0]
I only get Balcony.

Anyone know how can I select the first 2 words, both Balcony and Door?

Right, it’s just python:

' '.join(state_attr(trigger.entity_id, 'friendly_name').split()[:2])