question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use the new string formatting method in io.ascii.write

See original GitHub issue

As far as I can see the formatsparameter in io.ascii.write still uses the old string formatting.

The new method should be used instead.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
taldcroftcommented, Jan 7, 2019

Takeaway: feel free to change any examples or code from old style (e.g. format='%12.1f') to new style (e.g. 12.1f), which is the preferred idiom. This uses format(val, fmt) to actually do the formatting.

Note that is NOT the same as {:12.1f}, which uses fmt.format(val).

0reactions
dhomeiercommented, Jul 15, 2021

There was some recent discussion on performance implications of the different format options in context of logging which might be of interest here as well (the on-demand evaluation probably is not, since everything is written here anyway).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing Tables — Astropy v5.2
The write() function provides a way to write a data table as a formatted ASCII table.
Read more >
Writing tables — Astropy v0.4.2
The write() function provides a way to write a data table as a formatted ASCII table. For example: >>> >>> import numpy as...
Read more >
Formatting with astropy.io.ascii - python - Stack Overflow
I do this fairly often. To stay close to what you've written: df = data['ra', 'dec'] ascii.write(df, 'temp.dat', overwrite=True, ...
Read more >
Writing tables — Astropy v0.2.dev2728
The write() function provides a way to write a data table as a formatted ASCII table. For example: >>> from astropy.io import ascii...
Read more >
A Guide to the Newer Python String Format Techniques
Since f-strings are comparably new to the Python language, it's good for you to be ... Now, you can use Python's string .format()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found