Skip to content
Advertisement

How to set vertical the ouput in python?

I would like to create an output in `.txt format in python. The problem is that the results are showing horizontally.

How can I set my values vertically?

for example my output has the format:

JavaScript

I have tried:

JavaScript

and

JavaScript

But it is no use. My results are showing horizontally, and not vertically (with a column format I mean)

Advertisement

Answer

Writing to a file will always be horizontally unless you manually write each value in a different line. I suggest you use this simple foreach loop:

JavaScript

Of course, you can add “[” at the beginning and “]” at the end if necessary. Good Luck!

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement