Re: [Tutor] interesting behaviour with postional output

2011-11-14 Thread Steven D'Aprano
Cranky Frankie wrote: I'm working on writing out postional output. When I use this statement: print('%-40s%s' % (element_list[0], element_list[1])) I get nice, lined up columns on the screen. When I write to a file like this: new_line = ('%-40s%s%s' % (element_list[0], element_list[1],'\n')

Re: [Tutor] interesting behaviour with postional output

2011-11-14 Thread Rance Hall
On Mon, Nov 14, 2011 at 3:16 PM, Joel Goldstick wrote: > So, as was stated, best to use mono space if you are writing to a terminal. > If you are writing web pages, of course you have lots of formatting options > > -- > Joel Goldstick One option I've used in the past for issues such as this is e

Re: [Tutor] interesting behaviour with postional output

2011-11-14 Thread Joel Goldstick
On Mon, Nov 14, 2011 at 2:26 PM, Chris Fuller wrote: > > Fonts can be categorized as "fixed" or "proportional" widths. Proportional > width fonts have different widths depending on the character. > > If you want to line up text, you must use fixed width fonts like courier, > or > use tabs, but t

Re: [Tutor] interesting behaviour with postional output

2011-11-14 Thread Chris Fuller
Fonts can be categorized as "fixed" or "proportional" widths. Proportional width fonts have different widths depending on the character. If you want to line up text, you must use fixed width fonts like courier, or use tabs, but that can be unreliable. You can get fancy and measure the width

Re: [Tutor] interesting behaviour with postional output

2011-11-14 Thread Alan Gauld
On 14/11/11 18:58, Cranky Frankie wrote: I'm working on writing out postional output. When I use this statement: print('%-40s%s' % (element_list[0], element_list[1])) ... a very funny thing happens. When I open the file in Notepad, the columns are not lined up, however when I switch the fon

[Tutor] interesting behaviour with postional output

2011-11-14 Thread Cranky Frankie
I'm working on writing out postional output. When I use this statement: print('%-40s%s' % (element_list[0], element_list[1])) I get nice, lined up columns on the screen. When I write to a file like this: new_line = ('%-40s%s%s' % (element_list[0], element_list[1],'\n')) file_out.write(new_lin