Discussion:
[Tutor] How to print fixed length ascii?
Fast Primes
2015-05-16 04:11:45 UTC
Permalink
How do I set Python to print fixed length ascii--whereby all characters have the exact same length?




Thanks.




Alex
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Alan Gauld
2015-05-16 08:08:36 UTC
Permalink
Post by Fast Primes
How do I set Python to print fixed length ascii--whereby all characters have the exact same length?
It's not clear what you mean.
Do you mean you want to use the ASCII character set?
That limits all characters to 7 bits long.

If so we probably need a little bit more context
about what you are doing with these characters.
And whether they are ASCII to start with or if
you need to do some data conversion first.
What/how/where you are 'printing' them.


Or do you really mean you want a fixed width font so
that all characters take up the same amount of screen
space?

In that case the issue lies with your environment
and not with Python. How are you running the program?
(OS, Tools, Terminal type etc) Or if you are writing
a GUI how you are displaying the text - what kind
of widget?.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Steven D'Aprano
2015-05-16 09:49:17 UTC
Permalink
Post by Fast Primes
How do I set Python to print fixed length ascii--whereby all characters have the exact same length?
Use a fixed-width font, also known as a non-proportional, monospaced or
typewriter typeface.

E.g. Monaco (Apple Mac), Courier (Windows), Liberation Mono (Linux) etc.


Does that answer your question? If not, you will need to give more
detail.
--
Steve
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Loading...