Path: csiph.com!au2pb.net!feeder.erje.net!us.feeder.erje.net!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Regular expressions Date: Tue, 3 Nov 2015 14:56:00 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 21 Message-ID: References: <662g3blobme52hfoududj27err185v2npm@4ax.com> NNTP-Posting-Host: 67-130-15-94.dia.static.qwest.net X-Trace: reader1.panix.com 1446562560 11227 67.130.15.94 (3 Nov 2015 14:56:00 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Tue, 3 Nov 2015 14:56:00 +0000 (UTC) User-Agent: slrn/1.0.2 (Linux) Xref: csiph.com comp.lang.python:98160 On 2015-11-03, Tim Chase wrote: > On 2015-11-02 20:09, Seymore4Head wrote: >> How do I make a regular expression that returns true if the end of >> the line is an asterisk > > Why use a regular expression? > > if line[-1] == '*': Why use a negative index and then a compare? if line.endswith('*'): If you want to know if a string ends with something, just ask it! ;) -- Grant Edwards grant.b.edwards Yow! RELATIVES!! at gmail.com