当前位置:  首页>> 技术小册>> Python合辑2-字符串常用方法

23、startswith()

检查字符串是否是以指定内容开头,是则返回 True,否则返回 False。

  1. print('Patrick'.startswith('P'))
  2. # True