.startswith() would be better, because it wouldn't crash on an empty string.