python中format()函数的用法

时间:2024-10-12 10:18:49

1、打开pycharm,新建一个项目。

python中format()函数的用法

2、第一种是不设置拼接位置,按照默认顺序拼接。

python中format()函数的用法

3、打印出来显示正常。

python中format()函数的用法

4、第二种用数字序号拼接位置。

python中format()函数的用法

5、s2打印出来显示正常。

python中format()函数的用法

6、第三种是用变量名指定拼接位置。

python中format()函数的用法

7、第三种方式的话一定要对应前后的变量名字。

python中format()函数的用法
python中format()函数的用法
© 手抄报圈