On 19/02/15 22:50, Emile van Sebille wrote:
if cell.endswith(suffix, 14, 16) is False:
... so they'll never end with numeric values. Further, "".endswith()
accepts only one argument so you ought to get an error on this line.
Sorry Emile, The OP is correct.
######################
>>> help(''.endswith)
endswith(...) method of builtins.str instance
S.endswith(suffix[, start[, end]]) -> bool
Return True if S ends with the specified suffix, False otherwise.
With optional start, test S beginning at that position.
With optional end, stop comparing S at that position.
suffix can also be a tuple of strings to try.
#######################
The tuple is the set of suffices and the numbers are the
start/end points. Its not often seen like that but the
OP is quite correct.
The test against False is unusual it woyuld normally look like
if not cell.endswith(suffix, 14, 16):
but that is just a style issue.
--
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 - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor