I've created a python script to output every 1-4 character letter combinations from AAAA-ZZZZ etc.
It works perfectly, however I require only a line feed to be inserted at the end of the printed variable, since I am using this as a word list to be used in another script.
I have attempted to use both \r and \n, however using \n inserts both a Carriage Return and a Line Feed at the end (e.g AAAA CR LF), using \r inserts only a Carriage Return (e.g AAAA CR).
My question is would it be possible to insert just a line feed at the end, or is this impossible due to a limitation in python? i've tried using notepad to manually replace each character, and this works, however this is just patching up the problem and is impractical for use.
Many thanks for any help!
import string
alpha = string.ascii_uppercase
w=(a+b+c+d for a in alpha for b in alpha for c in alpha for d in alpha)
x=(a+b+c for a in alpha for b in alpha for c in alpha)
y=(a+b for a in alpha for b in alpha)
z=(a for a in alpha )
with open("Output.txt", "w") as text_file:
for i in [w, x, y, z]:
for k in i:
print("{}\r".format(k), file=text_file, end='')
the problem here is the line
print("{}\r".format(k), file=text_file, end='')