hi, i've found & adapted the following simple python script that copies one text file to another text file. the script works o.k., but only when i enter the name of the text file (both original, and the name of the new text file) surrounded by "double quotes".
i don't understand why this is. and worse, i don't know how to change the script so that the filenames inserted by the user no longer require these double quotes. this should be a real easy one, but, being a python newbie, i'd appreciate any suggestions. copyText2Text.py follows: """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" import os thecwd = os.getcwd() print "" print "Python Text File Copier" print "" print "Current Working Directory: "+thecwd a = input('Type name of file to copy surrounded by doublequotes') b = input('Type name of new file surrounded by doublequotes') #this was my attempt to add the double quotes automatically to the #names given by the users' input - but it doesn't work! #is this just a matter of knowing the proper escape characters?? #a = ""+a+"" #b = ""+b+"" fullfile1 = thecwd+"\\"+a inp = open(fullfile1,"r") fullfile2 = thecwd+"\\"+b outp = open(fullfile2,"w") for line in inp.readlines(): outp.write(line) print "Text file '"+fullfile1+"' copied successfully" print "to" print fullfile2 inp.close() outp.close() _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs