I am struggling on the Thread Shed project, Task 8.
Now, Iterate through
daily_transactions_splitand for each transaction iterate through the different data points and strip off any whitespace.
The code starts out with a giant string of which I’ve posted a snippet
daily_sales = \ """Edith Mcbride ;,;$1.21 ;,; white ;,; 09/15/17 ,Herbert Tran ;,; $7.29;,; white&blue;,; 09/15/17 ,Paul Clarke ;,;$12.52 ;,; white&blue ;,; 09/15/17 ,Lucille Caldwell ;,; $5.13 ;,; white ;,; 09/15/17, Eduardo George ;,;$20.39;,; white&yellow ;,;09/15/17 , Danny Mclaughlin;,;$30.82;,; purple ;,;09/15/17 ,Stacy Vargas;,; $1.85 ;,; purple&yellow ;,;09/15/17"""
Here is my code to “clean it up,” but I can’t get the last part to work, the part where I need to iterate through and remove white space.
Here is my code. This part works.
daily_sales_replaced = daily_sales.replace(";,;", "-") daily_transactions = daily_sales_replaced.split(",") daily_transactions_split =  for each in daily_transactions: split_by_dash = each.split("-") daily_transactions_split.append(split_by_dash)
This part doesn’t, and I can’t figure out why
transactions_clean =  for each_transaction in daily_transactions_split: for item in each_transaction: item.strip() transactions_clean.append(each_transaction)
I watched the video and it confused me even more.
Any help would be appreciated!