首页 > 解决方案 > 如何在用户给出的输入中的两个字符之间放置一个空格?我的错误在哪里??(我是初学者

问题描述

# Read an integer:
a = int(input())
# Print a value:
print(a[0] + " " + a[1])

如您所见,我正在尝试使用字符串放置空格,但出现错误,如下所示:

Traceback (most recent call last):
  File "python", line 4, in <module>
TypeError: 'int' object is not subscriptable

标签: python

解决方案


推荐阅读