Hi,
I hope everyone is well and healthy and staying at home!
And for some reason when I posted my code it removed the "tab" before some lines. Sorry about that!
I tried to use <code> button and the "Superscript" and "Subscript" still the snippet lost it's "tabs'.
Anyway, I have a strange problem, I have a file with the host's names like this:
FJ04TVVP0001NE
FJ04TVVP0002NE
FJ04TVVP0003NE
I need to read each line and add “\c$” to the end of each host to have lines like this:
FJ04TVVP0001NE\c$
For some reason, my code cannot add the “\c$” to the end of the string,
print out looks like this:
FJ04TVVP0001NE
\c$
FJ04TVVP0002NE
\c$
FJ04TVVP0003NE
\c$
The “\c$” always starts from a new line.
Here is the code I wrote:
st = "\c$"
ds = "\d$"
new_Batch = open ("C:/Scripts/NE_Col/Batch.txt","w")
f_EN_names = " C:/Scripts/NE_Col//NE_Col_names.txt"
with open(f_EN_names) as mfile:
for ln_f in mfile:
ln_f.rstrip()
print (ln_f+st)
new_Batch.write("NET USE \\\\"+ln_f+st+/u:Some Stuff Here”)
mfile.close()
new_Batch.close()
I hope everyone is well and healthy and staying at home!
And for some reason when I posted my code it removed the "tab" before some lines. Sorry about that!
I tried to use <code> button and the "Superscript" and "Subscript" still the snippet lost it's "tabs'.
Anyway, I have a strange problem, I have a file with the host's names like this:
FJ04TVVP0001NE
FJ04TVVP0002NE
FJ04TVVP0003NE
I need to read each line and add “\c$” to the end of each host to have lines like this:
FJ04TVVP0001NE\c$
For some reason, my code cannot add the “\c$” to the end of the string,
print out looks like this:
FJ04TVVP0001NE
\c$
FJ04TVVP0002NE
\c$
FJ04TVVP0003NE
\c$
The “\c$” always starts from a new line.
Here is the code I wrote:
Code:
ds = "\d$"
new_Batch = open ("C:/Scripts/NE_Col/Batch.txt","w")
f_EN_names = " C:/Scripts/NE_Col//NE_Col_names.txt"
with open(f_EN_names) as mfile:
for ln_f in mfile:
ln_f.rstrip()
print (ln_f+st)
new_Batch.write("NET USE \\\\"+ln_f+st+/u:Some Stuff Here”)
mfile.close()
new_Batch.close()