python 访问子字符串,可以使用方括号来截取字符串
可以截取字符串的一部分并与其他字段拼接

转义字符


字符串格式化
1、占位符(%)


2、format
基本语法是通过 {} 和 : 来代替以前的 %

3、f-string
f-string在形式上是以 f 或 F 修饰符引领的字符串(f'xxx' 或 F'xxx'),以大括号 {} 标明被替换的字段

python 访问子字符串,可以使用方括号来截取字符串
可以截取字符串的一部分并与其他字段拼接
转义字符
字符串格式化
1、占位符(%)
2、format
基本语法是通过 {} 和 : 来代替以前的 %
3、f-string
f-string在形式上是以 f 或 F 修饰符引领的字符串(f'xxx' 或 F'xxx'),以大括号 {} 标明被替换的字段
本文标题:python3-字符串1
本文链接:https://www.haomeiwen.com/subject/lguedktx.html
网友评论