Using python how to rotate data in text file from vertical alignment to horizontal alignment. Example:
T
h
i
s
v
e
r
t
i
c
a
l
t
e
x
t
And i want it to be like this:
This is horizontal text
Since you know that every character in your input is separated by a \n
(Line break) char, all you need to do is replace them with nothing.
If you are reading from a file you will need this code:
with open("PATH TO FILE.txt", r) as file:
input = file.read()
To Replace \n
characters with spaces you will need:
input.replace("\n", "")
Now just combine the two code snippets