摘要:
For the exercises in this chapter we need a list of English words. There are lots of word lists available on the Web, but the most suitable for our pu... 阅读全文
摘要:
The operators we have seen so far are all special characters like + and *, but there are a few operators that are words. in is a boolean operator that... 阅读全文
摘要:
A method is similar to a function – it takes arguments and returns a value – but the syntax is different. For example, the method upper takes a string... 阅读全文
摘要:
Find: In a sense, find is the opposite of the [] operator. Instead of taking an index and extracting the corresponding character, it takes a... 阅读全文
摘要:
It is tempting to use the [] operator on the left side of an assignment, with the intention of changing a character in a string. The ‘object... 阅读全文
摘要:
String slicesA segment of a string is called a slice. Selecting a slice is similar selecting a character: The operator [n:m] returns the par... 阅读全文
摘要:
A lot of computations involve processing a string one character at a time. Often they start at the beginning, select each character in turn, do someth... 阅读全文
摘要:
len is a build-in function that returns the numbers of characters in a string: Since we started counting at zero, the last index should be 5... 阅读全文
摘要:
A string is a sequence of characters. You can access the characters one at a time with the bracket operator. The second statement selects ch... 阅读全文