Hi, I’m trying to organise an entire library of detail items to be placed on a detail view. How do I get the first word from a list of multiple words and legnths? I was going to group by key with that. There’s string drop first word and last word but not get first word. Tried finding something to show where the first space in the string would be too but no luck.
Just to show first word from the list of words encase thats a poor description
# create a list to populate with results
result = []
# to iterate over a list of strings
for i in IN[0]:
# trim any left white space if any is present
left_trimmed = i.lstrip()
# split strings and get the first word before the first "space"
first = left_trimmed.split(' ',1)[0]
# add the first word in the string to the list of results
result.append(first)
# output the list of first words
OUT = result