python - Sorting a list with entries in string format -


in python, have list items (strings) this:

"1.120e+03 8.140e+02 3.234e+01 1.450e+00 1.623e+01 7.940e+02 3.113e+01 1.580e+00 1.463e+01" 

i want sort list based on size of first number in each string (smallest largest). in above case "1.120e+03".

i can think of couple of ways it, involve creating new lists , couple of loops guess isn't efficient (or elegant). there quick way this?

if sorting more once, suggest create class data , override methods comparing such __lt__.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -