Python - Thread Shed

Any help is greatly appreciated! My issue is that my data is NOT in brackets between names. ex. [‘Edith Mcbride’, ‘$1.21’, ‘white’, ‘09/15/17’, Without i can’t call using index-ing.

Thanks in advance! =)

#------------------------------------------------

Start coding below!

daily_sales_replaced=daily_sales.replace(’;,;’,"+")
#print(daily_sales_replaced)
daily_transactions=daily_sales_replaced.split(",")
#print(daily_transactions)
daily_transactions_split=
for sales1 in daily_transactions:
daily_transactions_split.append(sales1.split("+"))
#print(daily_transactions_split)

transactions_clean =

for sales2 in daily_transactions_split:
for data in sales2:
transactions_clean.append(data.replace("\n","").strip())

print(transactions_clean)

#customer=
#sales=
#thread_sold=

#for sales_final in transactions_clean:
#customer.append(sales_final[0])
#sales.append(sales_final[1])
#thread_sold.append(sales_final[2])

#print(customer)
#print(sales)
#print(thread_sold)

Okayy so… fix the part that should have created that list?

Sounds like you’re not too sure what your code is doing. The programmer (you) needs to be fully aware of everything going on.

My suggestion is to start over (possibly keeping a copy of your current code), and for each change you make, write out what the data looks like - did the change have the desired effect?
Since the data is big, you may want to use a much smaller amount of data while writing code, maybe two entries or so, that way you’re able to easily look at it.

(Also, a list doesn’t have brackets, that’s just something shown when printing a list so that you can see what type it is - a list isn’t text)

2 Likes

Understood. Thanks :blush: