Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74048
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'definitions': 0.07; 'string': 0.09; 'any)': 0.09; 'mentions': 0.09; 'question?': 0.09; 'assume': 0.14; '(empty': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'num)': 0.16; 'received:192.168.1.4': 0.16; 'subject:between': 0.16; 'subject:skip:m 10': 0.16; 'tuple': 0.16; 'elements': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'header:User-Agent:1': 0.23; 'specify': 0.24; '(or': 0.24; 'header:In-Reply-To:1': 0.27; 'words': 0.29; 'matching': 0.30; 'run': 0.32; 'subject:the': 0.34; 'could': 0.34; 'add': 0.35; 'there': 0.35; 'object,': 0.36; 'method': 0.36; 'hi,': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'entire': 0.61; 'email addr:gmail.com': 0.63; 'group,': 0.63; 'more': 0.64; 'between': 0.67; 'obvious': 0.74; 'different.': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=OZcWD3jY c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=u9EReRu7m0cA:10 a=ME1qA0UCCtsA:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=pGLkceISAAAA:8 a=bUE-UlH02FE5gH4WzlUA:9 a=4-5_c4fpq7PZXolx:21 a=F123THdtxQyq67Q2:21 a=QEXdDO2ut3YA:10 a=MSl-tDqOz04A:10 |
| X-AUTH | mrabarnett:2500 |
| Date | Sun, 06 Jul 2014 20:13:46 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: What is the difference between matchObj.group() and matchObj.group(0) |
| References | <809dbbdf-b452-4f25-a1ff-f00a2202939d@googlegroups.com> |
| In-Reply-To | <809dbbdf-b452-4f25-a1ff-f00a2202939d@googlegroups.com> |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11554.1404674030.18130.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1404674030 news.xs4all.nl 2891 [2001:888:2000:d::a6]:42528 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:74048 |
Show key headers only | View raw
On 2014-07-06 19:26, rxjwg98@gmail.com wrote: > Hi, > > I cannot get the difference between matchObj.group() and matchObj.group(0), > Although there definitions are obvious different. And group() mentions 'tuple'. > tuple means all the elements in line object? > > > > Match Object Methods > > Description > > group(num=0) This method returns entire match (or specific subgroup num) > groups() This method returns all matching subgroups in a tuple > (empty if there weren't any) > > > > I run the following code. Even I add more words to line object, Both have the > same output. > > Could you clarify this question? > matchObj.group(g) returns what was captured by group g. If you don't specify the group, it'll assume that you want group 0, which is the entire part of the string that matched.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
What is the difference between matchObj.group() and matchObj.group(0) rxjwg98@gmail.com - 2014-07-06 11:26 -0700 Re: What is the difference between matchObj.group() and matchObj.group(0) MRAB <python@mrabarnett.plus.com> - 2014-07-06 20:13 +0100
csiph-web