Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83233
| References | <54a83a19$0$6953$e4fe514c@dreader36.news.xs4all.nl> <CANNmrNZAH0gbk=UQgmXDRpPcs21tD0yVE-eEXSqPjbqpJ573=A@mail.gmail.com> |
|---|---|
| Date | 2015-01-03 22:38 +0330 |
| Subject | Re: surprise - byte in set |
| From | Amir Arsalan <am1r.ar3alan@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17386.1420459573.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Hi my friends.
On last result you have a , b , c binary.
>> set('abc')
{'a','b','c')
>> set(b'abc')
{97,98,99}
On Jan 3, 2015 10:25 PM, "patrick vrijlandt" <pvrijlandt@gmail.com> wrote:
> Hello list,
>
> Let me first wish you all the best in 2015!
>
> Today I was trying to test for occurrence of a byte in a set ...
>
> >>> sys.version
> '3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit
> (Intel)]'
> >>> 'b' in 'abc'
> True
> >>> b'b' in b'abc'
> True
> >>> 'b' in set('abc')
> True
> >>> b'b' in set(b'abc')
> False
>
> I was surprised by the last result. What happened?
> (Examples simplified; I was planning to manipulate the set)
>
> Patrick
>
> ---
> Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
> http://www.avast.com
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
surprise - byte in set patrick vrijlandt <pvrijlandt@gmail.com> - 2015-01-03 19:50 +0100 Re: surprise - byte in set Jason Friedman <jsf80238@gmail.com> - 2015-01-03 12:12 -0700 Re: surprise - byte in set Dan Stromberg <drsalists@gmail.com> - 2015-01-03 11:15 -0800 Re: surprise - byte in set Gary Herron <gherron@digipen.edu> - 2015-01-03 12:05 -0800 Re: surprise - byte in set patrick vrijlandt <pvrijlandt@gmail.com> - 2015-01-03 23:08 +0100 Re: surprise - byte in set Amir Arsalan <am1r.ar3alan@gmail.com> - 2015-01-03 22:38 +0330
csiph-web