I'm doing web scraping for prices, and in this particular site, they have the main prices in one class, and the cents in another class.
Basically I'm attributing each class to a list, so I'll end up with something looking like this:
prices = ["69", "99", "109"]
decimals = [",90", ",99", ",89"]
What I need is the resulting list:
full_price = ["69,90", "99,99", "109,89"]
I tried using two loops and append, but ended up having multiple undesired combinations.
How to I achieve the full_price list desired?
CodePudding user response:
You can achieve it rather easily by using zip:
prices = ["69", "99", "109"]
decimals = [",90", ",99", ",89"]
full_price = [''.join(x) for x in zip(prices, decimals)]