python chapter 7.3

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

str.islower()

Returns True iff all characters in the string are lowercase

str.isupper()

Returns True iff all characters in the string are uppercase

str.upper()

Returns a copy of the string with all letter converted to uppercase

str.swapcase()

Returns a copy of the string with all lowercase letter capitalized and all uppercase letter made lowercase

str.istrip(s)

Returns a copy of the string with leading occurrences of the characters in s removed

str.istrip

Returns a copy of the string with leading whitespace removed

str.rstrip(s)

Returns a copy of the string with trailing occurrences of the characters in s removed

str.rstrip

Returns a copy of the string with trailing whitespace removed

str.format(<<expression>>)

Returns a string made by substituting for placeholder fields in the string - each field is a pair of braces('{' and '}') with an integer in between: the expression arguements are number from left to right starting at 0.

str.lower()

Returns copy of the string with all letters converted to lowercase

str.strip()

Returns copy of the string with leading and trailing occurrences of the characters in s removed

str.find(s, beg)

Returns the index of the first occurrence of s at or after index beg in the string, or -1 if s doesn't occur in the string at or after index beg - the first character is at index 0. Case sensitive

str.find(s, beg, end)

Returns the index of the first occurrence of s between indices beg(inclusice) and enf (exclusice) in the string, or -1 id s does not occur in the string between indices beg and end - the first character is at index 0. Case sensitive

str.endswith(end)

Returns true iff the string ends

str.startswith(beginning)

Returns true iff the string starts with the letter in the string beginning - this is case sensitive

general form of calling a method

object_name.method_name(arguement)

str.capitalize()

returns a copy of the string with the first letter capitalized and the rest lower case

str.finds(s)

returns the index of the first occurrence of s in the string, or -1 if s doesn't occur in the string - the first character is at index 0. Case sensitive

str.count(s)

returns the number of nonoverlapping occurrences of s in the string


Ensembles d'études connexes

AP World Chapter 17 - Nomadic Empires And Eurasian Integration

View Set

U.S. History Final Exam: Module 13

View Set

Psychology Chapters 1-6 Study Questions

View Set

Pediatric Musculoskeletal Disorders

View Set

Chapter 05: Cochlear Physiology Quiz

View Set

Med Surg TEST 5 Practice Questions

View Set