-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring_methods.py
More file actions
24 lines (18 loc) · 916 Bytes
/
string_methods.py
File metadata and controls
24 lines (18 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
highlighted_poems = "Afterimages:Audre Lorde:1997, The Shadow:William Carlos Williams:1915, Ecstasy:Gabriela Mistral:1925, Georgia Dusk:Jean Toomer:1923, Parting Before Daybreak:An Qi:2014, The Untold Want:Walt Whitman:1871, Mr. Grumpledump's Song:Shel Silverstein:2004, Angel Sound Mexico City:Carmen Boullosa:2013, In Love:Kamala Suraiyya:1965, Dream Variations:Langston Hughes:1994, Dreamwood:Adrienne Rich:1987"
highlighted_poems_list = highlighted_poems.split(",")
highlighted_poems_stripped = []
for string in highlighted_poems_list:
highlighted_poems_stripped.append(string.strip())
highlighted_poems_details = []
for string in highlighted_poems_stripped:
highlighted_poems_details.append(string.split(":"))
titles = []
poets = []
dates = []
for poem in highlighted_poems_details:
titles.append(poem[0])
poets.append(poem[1])
dates.append(poem[-1])
print(titles)
print(poets)
print(dates)