[Tutor] another better way to do this ?
Peter Otten
__peter__ at web.de
Sun Jan 12 21:21:51 CET 2014
Emile van Sebille wrote:
> On 01/12/2014 06:43 AM, Dave Angel wrote:
>> Roelof Wobben <rwobben at hotmail.com> Wrote in message:
>>
>> That documentation says nothing about order. And the test cases
>> specifically contradict it.
>>
>> so try
>>
>> if set (b) <= set (a):
>
> or, as the OP specified, if order is relevant,
>
> def test(a,b):
> for ii in a:
> if ii not in b: a=a.replace(ii,"")
> return b in a
>>> def test(a,b):
... for ii in a:
... if ii not in b: a=a.replace(ii,"")
... return b in a
...
>>> test("axbxc", "abc")
True
>>> test("abbxc", "abc")
False
Is the second result desired?
More information about the Tutor
mailing list