Home  >  Article  >  Backend Development  >  How to output vertically in python

How to output vertically in python

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-06-22 15:42:2834128browse

How to output vertically in python

#How does python output vertically? Here are two methods to introduce to you:

The first one

str = "python"
for name in str[:]:
    print(name)

Related recommendations: "Python Video Tutorial

Running result:

p
y
t
h
o
n

Second type

print("\n".join("python"))

Running result:

p
y
t
h
o
n

The above is the detailed content of How to output vertically in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn