Which method to check if string index is queal to character.
MRAB
python at mrabarnett.plus.com
Mon Dec 28 13:32:00 EST 2020
On 2020-12-28 16:31, Bischoop 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.
>
[snip]
The shortest and quickest way to check whether "@" is in my_string is:
"@" in my_string
More information about the Python-list
mailing list