Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fixed width numbers
#11
Nwb's method is the proper one.
Reply
#12
(May-26-2019, 06:33 PM)Larz60+ Wrote: Nwb's method is the proper one.

how can i put an expression in that method? perfringo's method is obvious.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#13
For example?
Do you mean like:
print(f'Number with leading zeroes{10:020}')
Reply
#14
no. can i do this?
print(f'foo is{numbers["foo"]**powers["bar"]:20}')
it doesn't work in any form in my older Python 3.5.2. was f'' added in 3.6 or 3.7 ?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#15
(May-27-2019, 07:53 AM)Skaperen Wrote: was f'' added in 3.6 or 3.7 ?

Yep, you need 3.6 <= Python
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#16
then my only choice is your rjust() suggestion which i have already coded. i try to make my code work as far back as 3.3 if it's easy enough, else 3.4 or 3.5. but 3.5.2 is a must, partly because i have run into issues with Ubuntu 18.04 (sudo to root to run bash on amd64 arch fails to source .bashrc file ... it works OK on arm64).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python code to set column width 1418 11 7,171 Jan-20-2024, 07:20 AM
Last Post: Pedroski55
  Fixed colum width for rowLabels i Matplotlib pandabay 0 1,034 Jun-10-2023, 03:40 PM
Last Post: pandabay
  width of Unicode character Skaperen 6 4,041 Sep-27-2021, 12:41 AM
Last Post: Skaperen
  image.thumbnail(width, height) not working PCesarano 2 4,748 Apr-08-2021, 06:09 PM
Last Post: PCesarano
  Referencing a fixed cell Mark17 2 2,667 Dec-17-2020, 07:14 PM
Last Post: Mark17
  How can I get the width of a string in Python? aquerci 14 20,407 May-27-2019, 06:00 PM
Last Post: heiner55
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 4,981 May-09-2019, 12:19 PM
Last Post: Pleiades
  printing text tables with consistent width Skaperen 7 12,817 Jul-01-2018, 02:34 AM
Last Post: Skaperen
  How to measure an inclined beam width and height in image using python? zyb1003 1 3,929 Nov-07-2017, 05:02 AM
Last Post: heiner55
  Need help with dezoomify code (fixed Q) Ezra 7 6,581 Nov-01-2017, 01:54 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020