I am creating a dictionary by parsing a text file. <br><br>The code is below:<div><br></div><div><div>backup_servers = {}</div><div>fo = open('c:/test/backup_shares.txt')</div><div>for line in fo:</div><div> backup_server = line.split(',')</div>
<div> backup_servers[backup_server[0]]=backup_server[1]</div><div><br></div><div>for i, v in backup_servers.items():</div><div> backup_shares = i</div><div> archive_dir = v</div><div> archive_dir += '/'</div><div>
archive_dir += str(today)</div><div> archive_dir += '.txt'</div></div><div> </div><div>I need to use the output from the above with the win32.py modules to map drives and then create a file name with timestamp appended to it for backups that I'm doing and database dumps. The problem is that it's output like so:</div>
<div><br></div><div><div>c:/test</div><div>/backup_name_2011-03-03.txt \\server_name1\backup_share</div><div>c:/test</div><div>/backup_name_2011-03-03.txt \\server_name1\backup_share</div></div><div><br></div><div>I've tried this several ways and using a print command as so:</div>
<div><br></div><div>print backup_shares, archive_dir</div><div><br></div><div>print '%s %s' %( backup_shares, archive_dir)</div><div><br></div><div>and it still inserts a new line</div><div><br></div><div>The contents of the file are just:</div>
<div><br></div><div><div>\\server_name1\backup_share$,c:/test</div><div>\\server_name1\backup_share$,c:/test</div></div><div>I tried including the backup slashes in the text file, omitting them and including them in the print statement, to no avail.</div>
<div><br></div><div>Any comments?<br><br>Becky </div><div><br></div><div><br></div><div><br></div><div><br></div>