Hi guys, I am a beginner of Dynamo and python, how can I convert scientific notation string to number? I used string to number, but it can not recognize the scientific notation.
String.Split to split the numbers at the E.
String.ToNumber to convert the strings to numbers.
List.FetItemAtIndex to get the powers. Longest lacing here.
Math.Pow to raise 10 to the powers pulled in step two.
List.First to pull the first numbers from the list. Longest lacing here too.
Multiply the the firsts by the results of the Math.Pow node.
You will likely see some warnings (not errors) because not all values have an E so the string may not always split and there may not be any items at index 2, so check your data sets carefully.
you can use the float() Python function
input = IN if not hasattr(input, "__iter__"): input = [input] OUT = [float(x) for x in input]
Thank you guys!
where is the data coming from ? It’s probably easier to address the root cause, rather than converting strings to other data types