Converting\ joining a list into a float

20 Views Asked by At

by scraping a website I managed to get what i wanted, '2' '.' '7' '8' I've put them in a list. Now i want them all to be joined as a float 2.78

Can someone suggest something?

Thank You

I cannot join the decimal point to the number.

1

There are 1 best solutions below

0
Talha Tayyab On

You can simply join them with join() function.

l=['2' '.' '7' '8']
float(''.join(l))

#output
2.78