当前位置:  首页>> 技术小册>> Python合辑4-130个字符串操作示例

连接固定字符串和变量

  1. variable = 'Hello'
  2. print('This is the Test File ' + variable)
  3. variable = '10'
  4. print('This is the Test File ' + str(variable))

Output:

  1. This is the Test File Hello
  2. This is the Test File 10

该分类下的相关小册推荐: