例如:

print('你好'+1)  #程序报错  print中若使用字符串连接,则都得是字符串类型
print('你好'+str(1))  #输出  你好1
 print('{}年{}月{}日'.format(2020,5,20))     #输出2020年5月20日
print('%d年%d月%d日' % (2020,5,20))  #输出2020年5月20日

 

相关文章:

  • 2021-10-21
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
  • 2021-04-02
  • 2021-06-18
相关资源
相似解决方案