基於ArcGIS的python 編程(2)處理字符串

1、count 計數

mytest="GIS is cool"
print (mytest.count("i"))

2、lower方法

所有的大寫字符轉成小寫字符

mytest="GIS is cool"
print (mytest.lower())

3、upper方法

所有小寫轉大寫

mytest="GIS is cool"
print (mytest.upper())

4、title方法

單詞都是以大寫字符開始,其餘的都是小寫

mytest="GIS is cool"
print (mytest.title())

5、split分割字符

mytest="GIS is cool"
mylist=mytest.split(" ")
print (mylist)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章