Slicing vs .startswith
Hi,
I have a question about the comparison of efficiency of string slicing
and using string.startswi th.
For example, which one of the following would be more efficient, or ,
moreover, more pythonic?
if aa[:3] == 'abc':
vs
if aa.startswith(' abc'):
Thanks!
-shuhsien
Hi,
I have a question about the comparison of efficiency of string slicing
and using string.startswi th.
For example, which one of the following would be more efficient, or ,
moreover, more pythonic?
if aa[:3] == 'abc':
vs
if aa.startswith(' abc'):
Thanks!
-shuhsien
Comment