numpy.strings.title#
- strings.title(a)[source]#
返回字串或 Unicode 的元素級標題大小寫版本。
標題大小寫單字以大寫字元開頭,所有剩餘的大小寫字元皆為小寫。
元素級呼叫
str.title
。對於 8 位元字串,此方法與地區設定相關。
- 參數:
- a類陣列,具有
StringDType
、bytes_
或str_
dtype 輸入陣列。
- a類陣列,具有
- 返回:
- outndarray
StringDType
、bytes_
或str_
dtype 的輸出陣列,取決於輸入類型
參見
範例
>>> import numpy as np >>> c=np.array(['a1b c','1b ca','b ca1','ca1b'],'S5'); c array(['a1b c', '1b ca', 'b ca1', 'ca1b'], dtype='|S5') >>> np.strings.title(c) array(['A1B C', '1B Ca', 'B Ca1', 'Ca1B'], dtype='|S5')