最终的结果是捆绑在一起的,它需要分开
这是我的密码:
a = input('Clubhouse location: ')
for char in a:
code = str(ord(char))
b = a.replace(a, code)
print(b, end='')
以下是我的结果:
Clubhouse location: Treehouse
84114101101104111117115101
以下是它应该是什么:
Clubhouse location: Treehouse
84-114-101-101-104-111-117-115-101
只需使用
-
(如果char
不是字符串中的最后一个a
)作为print
函数的结束参数:您可以使用^{} :
您还可以将unpack字符码转换成} 参数:
print()
并使用^{使用
str.join
例如:
相关问题 更多 >
编程相关推荐