Which method to check if string index is queal to character.

Bischoop Bischoop at vimart.net
Mon Dec 28 20:51:29 EST 2020


On 2020-12-28, Michael Torrie <torriem at gmail.com> wrote:
> On 12/28/20 10:46 AM, Marco Sulla wrote:
>> On Mon, 28 Dec 2020 at 17:37, Bischoop <Bischoop at vimart.net> wrote:
>>>
>>> I'd like to check if there's "@" in a string and wondering if any method
>>> is better/safer than others. I was told on one occasion that I should
>>> use is than ==, so how would be on this example.
>>>
>>> s = 'this at mail.is'
>> 
>> You could do simply
>> 
>> if "@" in s:
>> 
>> but probably what you really want is a regular expression.
>
> https://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx/
>

Interested article.

--
Thanks


More information about the Python-list mailing list