python learning Notes (2) ----- Basics -> variable: String

String (string): arbitrary byte characters, single quote / double quotes / three pairs of marks represent

The basic string manipulation:

1. The value of the string read

(1) read the single subscript:

(2) slice (Slice):

   1--> [superscript bottom left: right lower standard], Note: this does not include the lower right target value

2 -> saving mode subscript a colon: [lower left mark:]: beginning from the lower left to the end of the standard

[: Lower right standard]: equivalent to [0: lower right mark]

/ [:]: All values

 

3-> with a step size of the slice read [superscript bottom left: right lower standard: step] 

 

4 -> small negative mark read, watch negative index starting at -1

(3) string combining (splicing)

(4) format string (%, format)

Mode 1:

Option 2:

(5) r / R of the original string control symbol

Note: This open folder address special needs

 

Guess you like

Origin www.cnblogs.com/xbg126/p/11333187.html