Class 17 Text ProcessingKey IdeasThere are string methods that perform case conversions There are string methods that deal with spacing: removing spaces, and justifying strings There are string methods that join strings and split strings There are string methods that find occurrences of substrings within strings, and find/replace There are “is” string methods that ask questions and return True/False There is a string module that contains useful string constants, such as a string of all lowercase letters, a string of all upper case letters, a string of all letters, and a string of all digits Built-insMethodscapitalize: capitalizes only the first word in a string title: capitalizes all words in a string swapcase: converts upper to lower and lower to upper strip: deletes both leading and trailing blanks lstrip: deletes only leading blanks rstrip: deletes only trailing blanks (on the right) zfill: specifies a field width, and pads with leading 0’s center: centers a string within a specified width ljust: left justifies a string within a specified width rjust: right justifies a string within a specified width join: concatenates all of the strings in an iterable; called with a string which is the separator split: splits a string into substrings, using a space as the default delimiter (although another delimiter can be specified) and returns a list of the substrings rsplit: just like split, except it splits from the right (which only matters if maxsplit is specified) splitlines: split lines in a string, using \n as the delimiter; returns a list partition: splits a string at the first occurrence of a specified separator and returns 3 things in a tuple: the left part, the separator, and the right part rpartition: same as partition but splits at the last occurrence of the specified separator rindex: returns the index of the last occurrence of the beginning of a substring within a string find: returns the index of the first occurrence of a substring within a string but if the substring is not found, returns -1 rfind: returns the index of the last occurrence of a substring within a string but if the substring is not found, returns -1 replace: finds occurrences of a substring within a string and replaces them with another string (by default, all, but a count can be passed) isalpha: returns True if all characters in a string are letters of the alphabet isalnum: returns True if all characters are letters or numbers isdigit: returns True if all characters in a string are digits String Module Constantsascii_lowercase: a string containing all of the lower case letters of the alphabet ascii_uppercase: a string containing all of the upper case letters of the alphabet ascii_letters: a string containing all letters of the alphabet digits: a string containing all of the digits论述题
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
Question at position 8 An excess of growth hormone (GH) before puberty can result in the development ofgigantism.Graves' disease.acromegaly.pituitary dwarfism.Clear my selection
Question at position 6 The most abundant supporting cells in the central nervous system are called Question Blank 1 of 1[input].
Question at position 5 In the eye, the lens functions tofocus light on the retina at the back of the eye.protect the surface of the eye.increase vision in low-light conditions.move the eye side to side.Clear my selection
Question at position 4 Olfactory (odor) receptors are chemoreceptors. TrueFalse
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!