04.08.2014 Views

o_18ufhmfmq19t513t3lgmn5l1qa8a.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

564 APPENDIX B ■ PYTHON REFERENCE<br />

Table B-6. String Methods (Continued)<br />

Method<br />

string.endswith(suffix[, start[, end]])<br />

string.expandtabs([tabsize])<br />

string.find(sub[, start[, end]])<br />

string.index(sub[, start[, end]])<br />

string.isalnum()<br />

string.isalpha()<br />

string.isdigit()<br />

string.islower()<br />

string.isspace()<br />

string.istitle()<br />

string.isupper()<br />

string.join(sequence)<br />

string.ljust(width[, fillchar])<br />

string.lower()<br />

string.lstrip([chars])<br />

Description<br />

Checks whether string ends with suffix,<br />

optionally restricting the matching with the<br />

given indices start and end<br />

Returns a copy of the string in which tab<br />

characters have been expanded using<br />

spaces, optionally using the given tabsize<br />

(default 8)<br />

Returns the first index where the substring<br />

sub is found, or –1 if no such index exists,<br />

optionally restricting the search to<br />

string[start:end]<br />

Returns the first index where the substring<br />

sub is found, or raises a ValueError if no<br />

such index exists, optionally restricting the<br />

search to string[start:end]<br />

Checks whether the string consists of<br />

alphanumeric characters<br />

Checks whether the string consists of<br />

alphabetic characters<br />

Checks whether the string consists of digits<br />

Checks whether all the case-based characters<br />

(letters) of the string are lowercase<br />

Checks whether the string consists of<br />

whitespace<br />

Checks whether all the case-based characters<br />

in the string following non-casebased<br />

letters are uppercase and all other<br />

case-based characters are lowercase<br />

Checks whether all the case-based characters<br />

of the string are uppercase<br />

Returns a string in which the string elements<br />

of sequence have been joined by string<br />

Returns a string of length max(len(string),<br />

width) in which a copy of string is left<br />

justified, padded with fillchar (default is<br />

space)<br />

Returns a copy of the string in which<br />

all case-based characters have been<br />

lowercased<br />

Returns a copy of the string in which all<br />

chars have been stripped from the beginning<br />

of the string (default whitespace<br />

characters)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!