Often, it is necessary to convert numbers from Nastran notation to float. For example, convert -5.75-3 into -5.75e-3.
We can write a simple python function for such conversion.
#Convert -5.75-3 into -5.75e-3 ? def nastran2float(s): s = s.replace('-','e-') s = s.replace('+','e+') if s[0] == 'e': s = s[1:] return float(s) x="-5.75-3" z=nastran2float(x) print(z)
Recent Comments