I have two lists of temperatures with Fahrenheit and Celsius, e.g.:(['23,6C', '16,5C', '38,4C',...]
and ['19.6F', '72.3F', '81.75F', '18.02F'
, ) the data type is string and I want to convert them into floats to be able to compute them into Kelvin. The letters can be removed.
I already tried to remove the letters with a for loop, but then I became a list of strings of each value before and after the point or the comma. When I want to convert them directly, it does not work because of the letters after the values.
for pos in list_cel:
for buchst in pos:
if buchst == "C":
buchst.replace("C", " ")
else:
nlist_cel.append(buchst)
print(nlist_cel)
#gives me a list of strings, seperated after each comma
like ['23','6',...]
instead of [23,6 or 23.6]
The output should look like this
[23.6, 16.5, 38.4,]
[19.6, 72.3, 81.75,]