python基础2之字符串、列表、字典、集合
发布时间:2020-12-16 23:55:22 所属栏目:Python 来源:网络整理
导读:table style="height: 30px; width: 1132px; background-color: #afeeee;" border="0" tr tdspan style="font-size: 16px; font-family: 'Microsoft YaHei';"一、python2 or python3 /td /tr /table 1.PRINT IS A FUNCTION Old: ,2*2 New: ( ,2*2 Old: x, Ol
<table style="height: 30px; width: 1132px; background-color: #afeeee;" border="0"> |
<table style="height: 30px; width: 1132px; border: 0px solid #7fffd4; background-color: #afeeee;" border="0">
<tr><td><span style="font-size: 16px; font-family: 'Microsoft YaHei';">二、字符串拼接</td>
</tr></table>
name==+ wd
name=
age=22
job=
msg=% my name wd age 22 job IT
name=
age=22
job=
msg= .format(_name=name,_age=age,_job= my name age : 22
job : IT
name=
age=22
job=
msg= my name age : 22
job : IT
<table style="height: 30px; width: 1132px; background-color: #afeeee; ; width: 1132px;" border="0">
<tr><td><span style="font-family: 'Microsoft YaHei'; font-size: 16px;">三、字符串</td>
</tr></table>
1.字符串常用操作
string
string
center(self,width,fillchar=
string
count(self,sub,start=None,end=
int
decode(self,encoding=None,errors=
object
encode(self,errors=
object
endswith(self,suffix,end=
bool
expandtabs(self,tabsize=
string
find(self,end=
int
format(*args,**kwargs):
string
index(self,end=
S.index(sub [,end]]) ->
Like S.find() but ValueError when the substring