python - Pretty printing a list of list of floats? -


Actually I have to dump the series of temperature readings in a text file. It's a delimited list of elements, where each line represents something (I do not know, and it just forces Fortune model, shudder ) to get it from our group I'm handling more or less, which is removing those temperature readings and dumping them into a text file.

Basically a quick example I have such a list (but with a lot more elements):

  temperature_type = [[1.343, 348.222, 484844.3333] , [12349.000002, in the past we have put it in a file, unfortunately there are some people who want to appear directly on the text file, and want to select something. Columns and some things are changing (for testing .. I really do not know ..) but they always complain about the column that they are not properly upstairs, they print the list above Are:  
  1.343 348.222 484844.333 12349.000002 -2.433333  

So the line above those wonderful decades is an easy way to do this?

You can do the right pad like this:

  set = '% 10f'% value  
  str = '% -10f'% val  

code>

< P> or set the precision to the combination pad and in 4 decimal places:

  str = '% -10.4f'% val  

:

Rows in lines: sys.stdout.write ('% 20f'%) for the line in line: [
  import rows rows = [[1.343, 348.222, 484844.3333], [12349.000002, -2.43333]] for rows in rows: Val) sys.stdout.write ("\ n") 1.343000 348.222000 484844.333300 12349.000002 -2.433330  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -