Latest web development tutorials

Python 練習實例62

Python 100例 Python 100例

題目:查找字符串。

程序分析:無。

程序源代碼:

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

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

以上實例輸出結果為:

2

Python 100例 Python 100例