Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27603 > unrolled thread
| Started by | Dave Angel <d@davea.name> |
|---|---|
| First post | 2012-08-22 01:17 -0400 |
| Last post | 2012-08-22 01:17 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: asking Dave Angel <d@davea.name> - 2012-08-22 01:17 -0400
| From | Dave Angel <d@davea.name> |
|---|---|
| Date | 2012-08-22 01:17 -0400 |
| Subject | Re: asking |
| Message-ID | <mailman.3628.1345612667.4697.python-list@python.org> |
On 08/22/2012 12:17 AM, Ian Foote wrote:
> Oops, hopefully this with indent correctly:
>
> def all_in(string, substrings):
> for substring in substrings:
> if substring not in string:
> return False
> return True
The POP's question was ambiguous (did he want to match any of the
substrings, or all of the substrings), but his example code:
("a" in "adfbdfc") or ( "b" in "adfbdfc") or ("c" in "adfbdfc" )
implements the opposite sense of what you have. So perhaps he'd want:
def any_in(string, substrings):
for substring in substrings:
if substring in string:
return True:
return False
--
DaveA
Back to top | Article view | comp.lang.python
csiph-web