我尝试使用那些脚本,但是它们不起作用。
print "".join(input.split())
和
input.replace("\n", "")
(如果可以,请尝试解释您的答案)
s1 = "abcd1234" # some horizontal string
s2 = "" # another string: we will use this to store verical form of s1
for i in s1:
s2 = s2 + i + '\n'
您只需要在字符串中的每个字符之后输入换行符(\n
)。就这么简单!