Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80517

What is ?s here?

Newsgroups comp.lang.python
Date 2014-11-11 01:37 -0800
Message-ID <a4b767a7-9669-4b4a-8068-63c23c2ef1c0@googlegroups.com> (permalink)
Subject What is ?s here?
From satishmlmlml@gmail.com

Show all headers | View raw


What does ?s do in the following piece of code?

import re, pprint
text = open('books.xml').read()
pattern = '(?s)isbn="(.*?)".*?<title>(.*?)</title>'
found = re.findall(pattern, text)
mapping = {isbn: title for (isbn, title) in found}
pprint.pprint(mapping)

Here is books.xml

<catalog>
       <book isbn="0-596-00128-2">
             <title>Python &amp; XML</title>
             <date>December 2001</date>
             <author>Jones, Drake</author>
       </book>
</catalog>

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

What is ?s here? satishmlmlml@gmail.com - 2014-11-11 01:37 -0800
  Re: What is ?s here? Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-11 17:34 +0000

csiph-web