Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 575453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:56:32+00:00 2026-05-13T13:56:32+00:00

Basically i have to dump a series of temperature readings, into a text file.

  • 0

Basically i have to dump a series of temperature readings, into a text file. This is a space delimited list of elements, where each row represents something (i don’t know, and it just gets forced into a fortran model, shudder). I am more or less handling it from our groups side, which is extracting those temperature readings and dumping them into a text file.

Basically a quick example is i have a list like this(but with alot more elements):

temperature_readings = [ [1.343, 348.222, 484844.3333], [12349.000002, -2.43333]]

In the past we just dumped this into a file, unfortunately there is some people who have this irritating knack of wanting to look directly at the text file, and picking out certain columns and changing some things (for testing.. i don’t really know..). But they always complain about the columns not lining up properly, they pretty much the above list to be printed like this:

    1.343     348.222     484844.333
12349.000002   -2.433333

So those wonderful decimals line up. Is there an easy way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:56:32+00:00Added an answer on May 13, 2026 at 1:56 pm

    you can right-pad like this:

    str = '%-10f' % val
    

    to left pad:

    set = '%10f' % val
    

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

    str = '%-10.4f' % val
    

    :

    import sys
    rows = [[1.343, 348.222, 484844.3333], [12349.000002, -2.43333]]
    for row in rows:
      for val in row:
        sys.stdout.write('%20f' % val)
      sys.stdout.write("\n")
    
            1.343000          348.222000       484844.333300
        12349.000002           -2.433330
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically I have an existing dump SQL file and I need to integrate
I basically have a program that filters records from one excel file to another
I basically have three tables, posts, images and postimages (this simply contains the ids
I basically have the same question as this guy .. The example in the
Ok i just don't have enough knowledge for this simple script apparently. Basically, in
I'm having to parse a text dump of a spreadsheet. I have a regular
I have basically MySQL dump from a WordPress database with some data. The whole
I have a text file that is formatted like JSON, but in a print/view
Not sure why this is occurring: Basically, I have an array that contains the
I have a huge SQL file that gets executed on the server. The dump

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.