- ArcPy and ArcGIS(Second Edition)
- Silas Toms Dara O'Beirne
- 116字
- 2025-04-04 19:02:02
Strings
Strings are used to contain any kind of character, and begin and end with quotation marks. Either single or double quotes can be used; the string must begin and end with the same type of quotation mark. Quoted text can appear within a string; it must use the opposite quotation mark to avoid conflicting with the string, as shown here:
>>> quote = 'This string contains a quote: "Here is the quote" '
A third type of string is also employed: a multiple line string, which starts and ends with three single quote marks like this:
>>> multiString = '''This string has
multiple lines and can go for
as long as I want it too'''