[Tutor] what am I not understanding?

Alan Gauld alan.gauld at btinternet.com
Mon Oct 20 02:03:12 CEST 2014


On 19/10/14 23:26, Clayton Kirkwood wrote:
> raw_table = ('''
> a: Ask    y: Dividend Yield
> b: Bid     d: Dividend per Share
> b2: Ask (Realtime)           r1: Dividend Pay Date
...
> o: Open’’’)
>
> key_name = raw_table.rstrip('\t')

rstrip() strips characters from the *right* hand side. When it finds a 
character that is not a strippable character(the n of Open in this case) 
it stops.

If you want to replace all tabs with spaces or nulls then you need
to use string.replace() (or sub for regex)

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list