TOCPython Literal Draft for Information Only
ContentPython String Literal
Python String LiteralA string is a sequence of characters. In other words, a string is basically a bunch of words and/or symbols. Although byte literal is one type of string literal in Python, the literal value of a byte literal is always considered as byte sequences or byte arrays.Definition of Python String LiteralA string literal is a sequence of characters from any source characters.stringliteral::=[stringprefix](shortstring | longstring) stringprefix::="r" | "u" | "R" | "U" | "f" | "F" | "fr" | "Fr" | "fR" | "FR" | "rf" | "rF" | "Rf" | "RF" shortstring::="'" shortstringitem* "'" | '"' shortstringitem* '"' longstring::="'''" longstringitem* "'''" | '"""' longstringitem* '"""' shortstringitem::=shortstringchar | stringescapeseq longstringitem::=longstringchar | stringescapeseq shortstringchar::=<any source character except "\" or newline or the quote> longstringchar::=<any source character except "\"> stringescapeseq::="\" <any source character> Features of Python StringThe Python string of string literal in Python have some typical features.Python String NotationA Python string is denoted by quotes. The ways to denote a Python string are. Single Quotes,Python String CataloguePython strings can be divided intoPython String PrefixPython String Prefix is used to specify the rules to interpret the following string literal. Whitespace is not allowed between the string prefix and the rest of the string literal. The meanings of supported string prefixs are:Python Source CharactersThe Python source character set is defined by the encoding declaration. The Python source character set is UTF-8 if no encoding declaration is given in the source file.Escape Sequences CharactersThe backslash (\) character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character. The recognized escape sequences are:Python Unicode LiterialAn unicode string literal is only used to restore support for the unicode legacy literal. The prefixSource and Reference
©sideway ID: 210100002 Last Updated: 1/2/2021 Revision: 0 Latest Updated Links
|
Home 5 Business Management HBR 3 Information Recreation Hobbies 8 Culture Chinese 1097 English 339 Reference 79 Computer Hardware 249 Software Application 213 Digitization 32 Latex 52 Manim 205 KB 1 Numeric 19 Programming Web 289 Unicode 504 HTML 66 CSS 65 SVG 46 ASP.NET 270 OS 429 DeskTop 7 Python 72 Knowledge Mathematics Formulas 8 Set 1 Logic 1 Algebra 84 Number Theory 206 Trigonometry 31 Geometry 34 Calculus 67 Engineering Tables 8 Mechanical Rigid Bodies Statics 92 Dynamics 37 Fluid 5 Control Acoustics 19 Natural Sciences Matter 1 Electric 27 Biology 1 |
Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019