<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 91久久精品国产91久久性色也 | 日韩精品视频免费网址| 九九精品成人免费国产片| 精品国产系列在线观看| 久久国产精品麻豆映画| 亚洲AV日韩精品一区二区三区| 99re热久久这里只有精品首页| 日本精品久久久久中文字幕| 成人精品视频在线观看| 呦交小u女国产精品视频| 久久国产精品系列| 久久se精品一区二区影院 | 国产乱码精品一区二区三区麻豆| 亚洲AV无码成人精品区蜜桃| 国产精品无码素人福利| 7777精品伊人久久久大香线蕉| 精品无码一区在线观看| 国产美女久久精品香蕉69| 精品无码中文视频在线观看| 糖心vlog精品一区二区三区| 亚洲精品网站在线观看你懂的| 久久国产乱子精品免费女| 国产精品成人小电影在线观看| 好吊操这里只有精品| 国产精品青青在线麻豆| 亚洲精品第五页中文字幕| 久久99热精品免费观看动漫| 中文字幕精品视频在线| 国产精品 一区 在线| 日本精品夜色视频一区二区| 国产精品漂亮美女在线观看| 久久这里只有精品国产免费10| 五月天婷婷精品视频| 精品无码一区二区三区亚洲桃色| 久久国内精品自在自线软件| 国产精品无码久久久久久| 中文字幕精品无码久久久久久3D日动漫| 亚洲精品国产日韩无码AV永久免费网| 成人国产精品2021| 杨幂精品国产专区91在线| 精品视频国产狼人视频|