Home > OS >  A string of python primer (study notes)
A string of python primer (study notes)

Time:01-14

1. Before using a string naming a variable pointing to the string, the variable naming best easy to understand, if it is a phrase can use shorthand, and separated the underline,
About the transformation of the string can use variable names. "upper ()", "variable name. The lower ()", "variable name. Title ()" are converted to uppercase, lowercase, and capitalize the first letter,
2. You can use {} variable name to read the string contents of the variable name is pointing to,
3. F is the abbreviated format, f can be used to create a complete message, such as print (f "hello, python world!" ),
Source:
The first_name="kevIN"
Last_name="durANt"
Full_name=f "{first_name} {last_name}"
"Hello, notice=f {full_name. The lower (). The title ()}"
Print (notice)
  • Related