Home | Mirror | Search

第 27 章 String

目錄

1. String function
1.1. str.find()
1.2. str.find()
2. Convert str to bytes in python
3. String format
4. Array
4.1. split / join
5. Datetime
5.1. datetime

1. String function

1.1. str.find()

找到字元,返回字元串位置。沒有找到返回 -1

"aaa bbb ccc".find('aaa')
			

1.2. str.find()

查找並替換字元串

a = 'hello word'
a.replace('word','python')
			
comments powered by Disqus