Python C859
count(x)
Minimum field width with using in operator to check if a
strings character or substring is contained
in the string
Conversion flags
precision
components(Rounding)
.replace()
.find(x)
find(x, start)
find(x, start,
end)
rfind(x)
1/
, Python C859
print('Student name (%5s)' % Same as find but searches the
'Bob' string in reverse, returning the last
the 5 specifies that there are a occurrence in the string
minimum of 5 characters and thus Returns the number of times x
the print out would be ( Bob) occurs in the string
alter the output of conversion
specifiers if 'b' in my_string
%08d adds leading zeros to
the mini- mum width of 8
characters
Indicates how many digits to the
right of the decimal should be
included
'%.1f' % 1.725 indicates a
precision of 1 resulting in 1.7
replace(old,new,count)
count replaces only the first
occurrence count can be left out
translation =
translation.replace('one', 'uno')
Returns the position of the first
occur- rence of item x in the
string
if my_str is 'Boo
Hoo!'
my_str.find('!')
Returns 7
my-str.find('Boo') Returns 0
my_str.find('oo') returns 1
Same as find(x) but begins the
search at position start
Same as find(x,start) but
stops the search at position
end
2/
, ()
startswith(x) endswith(x)
capitalize()
Comparing lower()
Strings
isalnum()
isdigit(
)
islower(
)
isupper
()
isspace
3/
, may be
compared Do not use identity operators
using where you should be using an
relational oper- equality operator
ators (<> <=
etc..) comparisons are case sensitive
equality Returns True if all characters int he
operator string are lowercase or uppercase
s (==,! letters, or the numbers 0-9
=)
member Returns True if all characters
ship are the numbers 0-9
operator Returns True if all characters are
s (in,not lower- case letters
in)
Returns True if all characters are
identity
upper- case letters
operator
s (is, is Returns True if all characters are
not) white- space
my_str = Returns True if the string starts
'Hello'
my_str == with x Returns True if the string
'Hello" ends with x
evaluates to
Returns a copy of the string with
True
the first character capitalized and
rest lower- cased
relational
comparison will Returns a copy of the string with
compare the all char- acters lowercased
ASCII unicode
values. if a
string is short-
er with all the
same
characters
then the
shorter is
considered less
than
4/
count(x)
Minimum field width with using in operator to check if a
strings character or substring is contained
in the string
Conversion flags
precision
components(Rounding)
.replace()
.find(x)
find(x, start)
find(x, start,
end)
rfind(x)
1/
, Python C859
print('Student name (%5s)' % Same as find but searches the
'Bob' string in reverse, returning the last
the 5 specifies that there are a occurrence in the string
minimum of 5 characters and thus Returns the number of times x
the print out would be ( Bob) occurs in the string
alter the output of conversion
specifiers if 'b' in my_string
%08d adds leading zeros to
the mini- mum width of 8
characters
Indicates how many digits to the
right of the decimal should be
included
'%.1f' % 1.725 indicates a
precision of 1 resulting in 1.7
replace(old,new,count)
count replaces only the first
occurrence count can be left out
translation =
translation.replace('one', 'uno')
Returns the position of the first
occur- rence of item x in the
string
if my_str is 'Boo
Hoo!'
my_str.find('!')
Returns 7
my-str.find('Boo') Returns 0
my_str.find('oo') returns 1
Same as find(x) but begins the
search at position start
Same as find(x,start) but
stops the search at position
end
2/
, ()
startswith(x) endswith(x)
capitalize()
Comparing lower()
Strings
isalnum()
isdigit(
)
islower(
)
isupper
()
isspace
3/
, may be
compared Do not use identity operators
using where you should be using an
relational oper- equality operator
ators (<> <=
etc..) comparisons are case sensitive
equality Returns True if all characters int he
operator string are lowercase or uppercase
s (==,! letters, or the numbers 0-9
=)
member Returns True if all characters
ship are the numbers 0-9
operator Returns True if all characters are
s (in,not lower- case letters
in)
Returns True if all characters are
identity
upper- case letters
operator
s (is, is Returns True if all characters are
not) white- space
my_str = Returns True if the string starts
'Hello'
my_str == with x Returns True if the string
'Hello" ends with x
evaluates to
Returns a copy of the string with
True
the first character capitalized and
rest lower- cased
relational
comparison will Returns a copy of the string with
compare the all char- acters lowercased
ASCII unicode
values. if a
string is short-
er with all the
same
characters
then the
shorter is
considered less
than
4/