Giter VIP home page Giter VIP logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
Agreed.

Original comment by [email protected] on 21 Mar 2012 at 5:30

from prettytable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
Hi,

Thanks for the suggestion.  I agree that this would be a nice feature, and it 
doesn't seem too hard.  I will have a go at implementing it shortly.  For now 
I'll probably just go with one format spec for all columns rather than a 
per-column setting, just because I have a lot of feature requests which have 
piled up and I want to try to make fast progress on them.  But upgrading to a 
per-column setting later is a definite possibility.

Cheers,
Luke

Original comment by [email protected] on 23 Mar 2012 at 3:55

  • Changed state: Accepted
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

from prettytable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
Hi,

I have just committed to the trunk of the svn repo with an implementation of 
this.  I would appreciate it very much if the people who have commented on this 
issue could give the new version a test and confirm whether or not it meets 
their needs.  Note, however, that if you have been using PrettyTable 0.5 until 
now, the API in the trunk version is substantially different.  Check out this 
Wiki page for instructions on how the new, cleaner API works: 
http://code.google.com/p/prettytable/wiki/Tutorial06

To set a floating point format for a PrettyTable object, just use:

MyTable.float_format = "4.2"

to print things using "%4.2f".  You can also do 04.2 to pad with leading 0s, 
etc.

Original comment by [email protected] on 24 Mar 2012 at 2:53

from prettytable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
Working well for me.  Thanks for adding the feature.  Per-column formats would 
be great.  

Original comment by [email protected] on 27 Mar 2012 at 12:47

from prettytable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
Per-column formatting is now supported in the trunk version.  It works like 
this:

table.float_format["Foo"] = "4.2"
table.float_format["Bar"] = "2.4"
table.float_format["Baz"] = "123.321"

If you try to use the old style syntax and do:

table.float_format = "4.2"

then this will set a format of "4.2" to all columns, over-writing any 
per-column formatting you previously set up.

If you are interested in per-column formatting, please try to give this a test 
soon.  If I do not hear of any bugs with the new per-column formatting in a few 
days I will close this ticket, since I'm trying to get a clean Issue page to 
release 0.6, and people will have to open a new one to report bugs.

Original comment by [email protected] on 1 May 2012 at 4:54

from prettytable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
Forgot to mention - there is now similar support for integer formatting strings 
with the same interface as float formatting, e.g.

table.int_format["Foo"] = "05"

will print any integer data in the "Foo" column padded out to 5 characters with 
leading zeros.

Original comment by [email protected] on 1 May 2012 at 4:59

from prettytable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
Closing this issue since float formatting is now implemented and available on a 
per-column basis, and I've received no bug reports or negative feedback.  If 
anybody has float formatting requirements in the future which PrettyTable 
doesn't support, feel free to open a new ticket.

Original comment by [email protected] on 4 May 2012 at 6:18

  • Changed state: Fixed

from prettytable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.