Разделение строки на список

Простые типы / Строки

str_data = "1981|Kim Victoria|engineer"
# The separator is plain text, | needs no escape
lst_data = str_data.split("|")
# lst_data is ['1981', 'Kim Victoria', 'engineer']

# Unpacking: one name per part
year_text, name, position = lst_data
# name is 'Kim Victoria', position is 'engineer'
year = int(year_text)
# year is 1981

# No argument: a run of spaces is one separator
words = "red  green   blue".split()
# words is ['red', 'green', 'blue']
spaced = "red  green".split(" ")
# spaced is ['red', '', 'green']

print(f"{lst_data = }")
print(f"{year = }")
print(f"{name = }")
print(f"{position = }")
print(f"{words = }")
print(f"{spaced = }")