startswith
/endswith
checks PY-W0077The methods startswith
and endswith
for string instances accept two types of Python constructs as the first argument. The types are:
It is recommended to merge the arguments of multiple calls to startswith
/endswith
connected by or
.
if s.startswith('a') or s.startswith('b'):
...
if s.startswith(('a', 'b')):
...