""" python中find函數的功能是查找指定的字符串並返回該字符串的起始位置。 字符串.find(str, pos_start, pos_end) 參數如下: str:被查找"字符串" pos_start:查找的首字母位置(從0開始計數。默認:0) pos_end: 查找的末尾位置(默認-1) 返回值:如果查到:返回查找的第一個出現的位置。否則,返回-1。 """ msg = 'hello world!' print(msg.find('l')) print(msg[msg.find('l'):msg.find('o')])