[Tutor] Need some help on output

Becky Mcquilling ladymcse2000 at gmail.com
Fri Mar 4 02:18:11 CET 2011

I am creating a dictionary by parsing a text file.

The code is below:

backup_servers = {}
fo = open('c:/test/backup_shares.txt')
for line in fo:
  backup_server = line.split(',')

for i, v in backup_servers.items():
  backup_shares = i
  archive_dir = v
  archive_dir += '/'
  archive_dir += str(today)
  archive_dir += '.txt'

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:

/backup_name_2011-03-03.txt \\server_name1\backup_share
/backup_name_2011-03-03.txt \\server_name1\backup_share

I've tried this several ways and using a print command as so:

print backup_shares, archive_dir

print '%s %s' %( backup_shares, archive_dir)

and it still inserts a new line

The contents of the file are just:

I tried including the backup slashes in the text file, omitting them and
including them in the print statement, to no avail.

Any comments?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110303/4aea8429/attachment.html>

More information about the Tutor mailing list