Python Practice Example 62

Python 100例Python 100 Examples

Problem:Search for a string.

Program analysis:None.

Program source code:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

sStr1 = 'abcdefg'
sStr2 = 'cde'
print sStr1.find(sStr2)

The output result of the above example is:

2

Python 100例Python 100 Examples

Other extensions