0001aboutSTRWord文档下载推荐.docx
《0001aboutSTRWord文档下载推荐.docx》由会员分享,可在线阅读,更多相关《0001aboutSTRWord文档下载推荐.docx(16页珍藏版)》请在冰豆网上搜索。
printx.__add__("
hello"
)
printx.__contains__("
isaTest"
|__eq__(self,value,/)
|Returnself==value.
|__format__(...)
|S.__format__(format_spec)->
str
|ReturnaformattedversionofSasdescribedbyformat_spec.
|__ge__(self,value,/)
|Returnself>
=value.
|__getattribute__(self,name,/)
|Returngetattr(self,name).
|__getitem__(self,key,/)
|Returnself[key].
|__getnewargs__(...)
|__gt__(self,value,/)
value.
|__hash__(self,/)
|Returnhash(self).
|__iter__(self,/)
|Implementiter(self).
|__le__(self,value,/)
|Returnself<
|__len__(self,/)
|Returnlen(self).
|__lt__(self,value,/)
|__mod__(self,value,/)
|Returnself%value.
|__mul__(self,value,/)
|Returnself*value.n
|__ne__(self,value,/)
|Returnself!
|__new__(*args,**kwargs)frombuiltins.type
|Createandreturnanewobject.Seehelp(type)foraccuratesignature.
|__repr__(self,/)
|Returnrepr(self).
|__rmod__(self,value,/)
|Returnvalue%self.
|__rmul__(self,value,/)
|Returnself*value.
|__sizeof__(...)
|S.__sizeof__()->
sizeofSinmemory,inbytes
|__str__(self,/)
|Returnstr(self).
|capitalize(...)
|S.capitalize()->
|ReturnacapitalizedversionofS,i.e.makethefirstcharacter
|haveuppercaseandtherestlowercase.
|casefold(...)
|S.casefold()->
|ReturnaversionofSsuitableforcaselesscomparisons.
|center(...)
|S.center(width[,fillchar])->
|ReturnScenteredinastringoflengthwidth.Paddingis
|doneusingthespecifiedfillcharacter(defaultisaspace)
printx.center(50,'
_'
#************thisisaTestingString!
************
|
|count(...)
|S.count(sub[,start[,end]])->
int
|Returnthenumberofnon-overlappingoccurrencesofsubstringsubin
|stringS[start:
end].Optionalargumentsstartandendare
|interpretedasinslicenotation.
printx.count('
'
|encode(...)
|S.encode(encoding='
utf-8'
errors='
strict'
)->
bytes
|EncodeSusingthecodecregisteredforencoding.Defaultencoding
|is'
.errorsmaybegiventosetadifferenterror
|handlingscheme.Defaultis'
meaningthatencodingerrorsraise
|aUnicodeEncodeError.Otherpossiblevaluesare'
ignore'
'
replace'
and
|'
xmlcharrefreplace'
aswellasanyothernameregisteredwith
|codecs.register_errorthatcanhandleUnicodeEncodeErrors.
|endswith(...)
|S.endswith(suffix[,start[,end]])->
bool
|ReturnTrueifSendswiththespecifiedsuffix,Falseotherwise.
|Withoptionalstart,testSbeginningatthatposition.
|Withoptionalend,stopcomparingSatthatposition.
|suffixcanalsobeatupleofstringstotry.
|expandtabs(...)
|S.expandtabs(tabsize=8)->
|ReturnacopyofSwherealltabcharactersareexpandedusingspaces.
|Iftabsizeisnotgiven,atabsizeof8charactersisassumed.
|find(...)
|S.find(sub[,start[,end]])->
|ReturnthelowestindexinSwheresubstringsubisfound,
|suchthatsubiscontainedwithinS[start:
end].Optional
|argumentsstartandendareinterpretedasinslicenotation.
|Return-1onfailure.
|format(...)
|S.format(*args,**kwargs)->
|ReturnaformattedversionofS,usingsubstitutionsfromargsandkwargs.
|Thesubstitutionsareidentifiedbybraces('
{'
and'
}'
).
|format_map(...)
|S.format_map(mapping)->
|ReturnaformattedversionofS,usingsubstitutionsfrommapping.
|index(...)
|S.index(sub[,start[,end]])->
|LikeS.find()butraiseValueErrorwhenthesubstringisnotfound.
|isalnum(...)
|S.isalnum()->
|ReturnTrueifallcharactersinSarealphanumeric
|andthereisatleastonecharacterinS,Falseotherwise.
|isalpha(...)
|S.isalpha()->
|ReturnTrueifallcharactersinSarealphabetic
|isdecimal(...)
|S.isdecimal()->
|ReturnTrueifthereareonlydecimalcharactersinS,
|Falseotherwise.
|isdigit(...)
|S.isdigit()->
|ReturnTrueifallcharactersinSaredigits
|isidentifier(...)
|S.isidentifier()->
|ReturnTrueifSisavalididentifieraccording
|tothelanguagedefinition.
|Usekeyword.iskeyword()totestforreservedidentifiers
|suchas"
def"
and"
class"
.
importkeyword
printkeyword.iskeyword("
|islower(...)
|S.islower()->
|ReturnTrueifallcasedcharactersinSarelowercaseandthereis
|atleastonecasedcharacterinS,Falseotherwise.
|isnumeric(...)
|S.isnumeric()->
|ReturnTrueifthereareonlynumericcharactersinS,
print"
98673"
.isalnum()
|isprintable(...)
|S.isprintable()->
|ReturnTrueifallcharactersinSareconsidered
|printableinrepr()orSisempty,Falseotherwise.
|isspace(...)
|S.isspace()->
|ReturnTrueifallcharactersinSarewhitespace
|istitle(...)
|S.istitle()->
|ReturnTrueifSisatitlecasedstringandthereisatleastone
|characterinS,i.e.upper-andtitlecasecharactersmayonly
|followuncasedcharactersandlowercasecharactersonlycasedones.
|ReturnFalseotherwise.
|isupper(...)
|S.isupper()->
|ReturnTrueifallcasedcharactersinSareuppercaseandthereis
|join(...)
|S.join(iterable)->
|Returnastringwhichistheconcatenationofthestringsinthe
|iterable.TheseparatorbetweenelementsisS.
|ljust(...)
|S.ljust(width[,fillchar])->
|ReturnSleft-justifiedinaUnicodestringoflengthwidth.Paddingis
|doneusingthespecifiedfillcharacter(defaultisaspace).
|lower(...)
|S.lower()->
|ReturnacopyofthestringSconvertedtolowercase.
|lstrip(...)
|S.lstrip([chars])->
|ReturnacopyofthestringSwithleadingwhitespaceremoved.
|IfcharsisgivenandnotNone,removecharactersincharsinstead.
|partition(...)
|S.partition(sep)->
(head,sep,tail)
|SearchfortheseparatorsepinS,andreturnthepartbeforeit,
|theseparatoritself,andthepartafterit.Iftheseparatorisnot
|found,returnSandtwoemptystrings.
|replace(...)
|S.replace(old,new[,count])->
|ReturnacopyofSwithalloccurrencesofsubstring
|oldreplacedbynew.Iftheoptionalargumentcountis
|given,onlythefirstcountoccurrencesarereplaced.
print"
.replace("
86"
"
_RPLS_"
|rfind(...)
|S.rfind(sub[,start[,end]])->
|ReturnthehighestindexinSwheresubstringsubisfound,
printx
foriinxrange(len(x)):
sys.stdout.write(str(i%10))
print
printx.rfind('
)
0,17)
|rindex(...)等同于上面的函数
|S.rindex(sub[,start[,end]])->
|LikeS.rfind()butraiseValueErrorwhenthesubstringisnotfound.
|rjust(...)
|S.rjust(width[,fillchar])->
|ReturnSright-justifiedinastringoflengthwidth.Paddingis
|rpartition(...)
|S.rpartition(sep)->
|SearchfortheseparatorsepinS,startingattheendofS,andreturn
|thepartbeforeit,theseparatoritself,andthepartafterit.Ifthe
|separatorisnotfound,returntwoemptystringsandS.
|rsplit(...)
|S.rsplit(sep=None,maxsplit=-1)->
listofstrings
|ReturnalistofthewordsinS,usingsepasthe
|delimiterstring,startingattheendofthestringand
|workingtothefront.Ifmaxsplitisgiven,atmostmaxsplit
|splitsaredone.Ifsepisnotspecified,anywhitespacestring
|isaseparator.
|rstrip(...)
|S.rstrip([chars])->
|ReturnacopyofthestringSwithtrailingwhitespaceremoved.
|split(...)
|S.split(sep=None,maxsplit=-1)->
|delimiterstring.Ifmaxsplitisgiven,atmostmaxsplit
|splitsaredone.IfsepisnotspecifiedorisNone,any
|whitespacestringisaseparatorandemptystringsare
|removedfromtheresult.
|splitlines(...)
|S.splitlines([keepends])->
|ReturnalistofthelinesinS,breakingatlineboundaries.
|Linebreaksarenotincludedintheresultinglistunlesskeepends
|isgivenandtrue.
|startswith(...)
|S.startswith(prefix[,start[,end]])->