<strike id="cakm0"></strike>
  • <button id="cakm0"><dl id="cakm0"></dl></button>
  • <samp id="cakm0"><tbody id="cakm0"></tbody></samp>
    <samp id="cakm0"><pre id="cakm0"></pre></samp><ul id="cakm0"></ul>
    <strike id="cakm0"></strike>
    <li id="cakm0"></li>
  • <ul id="cakm0"></ul>
  • 更多精彩內容,歡迎關注:

    視頻號
    視頻號

    抖音
    抖音

    快手
    快手

    微博
    微博

    python string函數

    文檔

    python string函數

    python string函數包括:1、str.capitalize();2、str.upper();3、str.lower();4、str.swapcase();5、str.title();6、str.center()。
    推薦度:
    導讀python string函數包括:1、str.capitalize();2、str.upper();3、str.lower();4、str.swapcase();5、str.title();6、str.center()。

    python string函數是什么?一起來看下吧:

    python string函數包括:

    1、str.capitalize:將原字符串內的首字母轉成大寫,其他部分小寫,再返回新字符串

    print("s.capitalize()?=?{function}"
    s.capitalize()?=?Abcada?a

    2、str.lower:將原字符串的字母轉為小寫

    print("s.lower()?=?{function}".format(function?=?s.lower()))
    s.lower()?=?abcada?a

    3、str.upper:將原字符串的字母轉為大寫

    print("s.upper()?=?{function}".format(function?=?s.upper()))
    s.upper()?=?ABCADA?A

    4、str.swapcase:將原字符串的大寫小寫反轉

    print("s.swapcase()?=?{function}".format(function?=?s.swapcase()))
    s.swapcase()?=?ABCAdA?A

    5、str.title:原字符串內如果有特殊字符(包括數字)連接字母,則將特殊字符后的首個英文字母轉化為大寫形態,并返回新字符串

    print("s2.title()?=?{function}".format(function?=?s2.title()))
    s2.title()?=?123A?Abc?Abcsaa?S

    6、str.center:str.center(寬度,填充字符) 將字符串以居中的格式返回,若寬度值比len(s)小則返回原字符串,填充以從左到右為規則,填充字符的默認值為空格,值可以自己更改

    print("s2.center()?=?{function}".format(function?=?s2.center(19,'&')))
    print("s2.center()?=?{function}".format(function?=?s2.center(20,'&')))
    #s2?=?123a?abc?ABCSAa?s
    s2.center()?=?&123a?abc?ABCSAa?s?
    s2.center()?=?&123a?abc?ABCSAa?s?&

    7、str.expandtabs:str.expandtabs(tabsize = 8) 將原字符串中 以前的字符補滿8位(默認),tabsize的值從0-7即8位,在0-7中任意取值則默認tabsize = 8,此后往上+1,就相當于增加一個空格

    print("s3.expandtabs?={function}".format(function?=?s3.expandtabs()))
    print("s3.expandtabs?={function}".format(function?=?s3.expandtabs(0)))
    print("s3.expandtabs?={function}".format(function?=?s3.expandtabs(5)))
    print("s3.expandtabs?={function}".format(function?=?s3.expandtabs(8)))
    print("s3.expandtabs?={function}".format(function?=?s3.expandtabs(9)))#s3?=?"	as?		b123"
    s3.expandtabs?=????????as??????????????b123
    s3.expandtabs?=as?b123
    s3.expandtabs?=?????as????????b123
    s3.expandtabs?=????????as??????????????b123
    s3.expandtabs?=?????????as

    除了上述舉例的,string函數還有許多實用的函數。

    以上就是小編今天的分享,希望可以幫助到大家。

    文檔

    python string函數

    python string函數包括:1、str.capitalize();2、str.upper();3、str.lower();4、str.swapcase();5、str.title();6、str.center()。
    推薦度:
    為你推薦
    資訊專欄
    熱門視頻
    相關推薦
    python構造函數 python延時函數 debug error怎么解決 python讀取json并解析 python 列表添加 python字典按值的大小排序 python 排序算法 spring boot mysql配置 vue動態綁定style js date加一天 字符轉換成ascii碼 c語言struct用法 java reentrantlock python tkinter教程 js獲取日期 python numpy教程 opencv安裝教程python js獲取隨機數 ubuntu卸載mysql cad的基本命令 python類的繼承 python遞歸函數 python內置函數 python判斷字符串相等 python查看已安裝的包 python強制類型轉換 python input函數怎么用 python類型轉換 python split函數用法 python讀取json python組合數據類型 python查看變量類型 python split函數 c++ template用法 老抽和生抽的區別 拉鏈下滑如何解決 防藍光眼鏡怎么辨別 蔥怎么保存 老姜和生姜的區別 新鮮蘑菇怎么保存
    Top 亚洲精品色午夜无码专区日韩| 国产精品中文久久久久久久| 免费精品久久久久久中文字幕| 亚洲精品一卡2卡3卡三卡四卡| 国产午夜精品一区理论片飘花| 热久久综合这里只有精品电影| 51精品视频免费国产专区| 国产精品亚洲一区二区三区在线 | 99热门精品一区二区三区无码| 国产亚洲精品a在线观看| 国内精品久久久久影院蜜芽| 久久精品国产久精国产果冻传媒| 久久99国产精品久久99| 国产精品嫩草影院久久| 精品久久天干天天天按摩| 国产人成精品香港三级在| 无码人妻丰满熟妇精品区| 亚洲日韩精品无码一区二区三区| 国产SUV精品一区二区88L| 国产精品一区二区毛卡片| 精品国偷自产在线| 精品亚洲A∨无码一区二区三区| 久久福利青草精品资源站免费| 亚洲AV永久无码精品一区二区国产| 精品国产一区二区三区av片| 久久福利资源国产精品999| 精品人妻va出轨中文字幕| 无码精品日韩中文字幕| 国产精品人成在线播放新网站| 老司机成人精品视频lsj| 亚洲A∨午夜成人片精品网站| 国产精品久久久久网站| 国产精品亚洲一区二区三区 | 国产女主播精品大秀系列| 久久精品成人影院| 国产精品成人69XXX免费视频| 视频二区国产精品职场同事| 四虎8848精品永久在线观看| 国产av无码久久精品| www.久久精品| 国产69精品久久久久9999|