Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.python Subject: Re: Unicode and Python - how often do you index strings? Date: Thu, 05 Jun 2014 12:58:25 -0700 Organization: Nightsong/Fort GNOX Lines: 7 Message-ID: <7xioof9li6.fsf@ruckus.brouhaha.com> References: <7xr433z0g3.fsf@ruckus.brouhaha.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx05.eternal-september.org; posting-host="8ff39c3b56f8fea9a226ae9d8294e48e"; logging-data="19357"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/o1/gkWz1rcVp7QfNBvll+" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:IP5A6CCq8D1tRaegCOrVjjJqMTo= sha1:XAAia8QRVjm06rNg1wK6l3qCiXw= Xref: csiph.com comp.lang.python:72751 Ryan Hiebert writes: > How so? I was using line=line[:-1] for removing the trailing newline, and > just replaced it with rstrip('\n'). What are you doing differently? rstrip removes all the newlines off the end, whether there are zero or multiple. In perl the difference is chomp vs chop. line=line[:-1] removes one character, that might or might not be a newline.