日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python处理字符串数组慢_Python字符串处理 - str/bytes

發布時間:2023/12/1 python 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python处理字符串数组慢_Python字符串处理 - str/bytes 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. str

str.count(sub[, start[, end]])

str.encode(encoding="utf-8", errors="strict")

str.format(*args, **kwargs) # s = "this is from {}".format(__file__)

str.find(sub[, start[, end]]) # 沒有查找到子串,返回-1

str.rfind(sub[, start[, end]]) # 沒有查找到子串,則報Except

str.index(sub[, start[, end]])

str.replace(old, new[, count])

str.join(iterable)

str.split(sep=None, maxsplit=-1)

str.splitlines([keepends]) # keepends: 在輸出結果里是否保留換行符('\r', '\r\n', '\n'),默認為False,不包含換行符;如果為True,則保留換行符。

str.strip([chars])

str.lstrip([chars])

str.rstrip([chars])

str.partition(sep) # 通過sep將字符串分成三部分

str.rpartition(sep)

In [85]: "what do you do wait".rpartition("do")

Out[85]: ('what do you ', 'do', ' wait')

str.expandtabs(tabsize=8) # 把字符串中的 tab 符號('\t')轉為空格

str.zfill(width) # 返回指定長度width的字符串,原字符串右對齊,前面填充0

str.upper()

str.lower()

str.islower()

c.isalpha() # 字母

c.isdecimal() # Unicode數字,,全角數字(雙字節)

c.isdigit() # Unicode數字,byte數字(單字節),全角數字(雙字節),羅馬數字

c.isnumeric() # Unicode數字,全角數字(雙字節),羅馬數字,漢字數字

str.startswith(prefix[, start[, end]])

str.endswith(suffix[, start[, end]])

eval(source[, globals[, locals]]) # 將str作為有效表達式并返回結果

2. bytes / bytearray

classmethod

fromhex(string)

encode()

bytes.count(sub[, start[, end]])

bytes.decode(encoding="utf-8", errors="strict")

bytearray.decode(encoding="utf-8", errors="strict")

bytes.find(sub[, start[, end]])

bytearray.find(sub[, start[, end]])

bytes.join(iterable)

bytearray.join(iterable)

bytes.replace(old, new[, count])

bytearray.replace(old, new[, count])

bytes.startswith(prefix[, start[, end]])

bytearray.startswith(prefix[, start[, end]])

3. printf-style String Formatting

總結

以上是生活随笔為你收集整理的python处理字符串数组慢_Python字符串处理 - str/bytes的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。