I'm new to Python so please go easy, I'm sure my question has a very simple solution, that seems to be evading me. I'm trying to write a string to a file in this format:
"string1" variable "string2"
But it always seems to write "string2" "string1" variable
Here is my code:
inF = open("f:\test\Users.txt", 'r')
outF = open("f:\test\commands.txt", 'w')
for line in iter(inF):
    s = "{0} {1} {2}" .format("adduser ",line," password")
    outF.write(s)
inF.close()
outF.close()
I have also tried:
for line in iter(inF):
    outF.write("adduser " + lines + " password")
Output is always:
passwordadduser user.name
itercall is redundant, but not harmful. Anyway, I upvoted this and oppose closing it - it's indeed probably that the output lines mostly look like OP describes; just that the subtlety causing the problem has been missed. And isn't that par for the course? :)