appending file

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Sat Jun 30 06:36:34 CEST 2007


Kuo a écrit :
> Hi,
> I'm trying to read a file (fileA) and append to another file(fileB). 
> However, I always get "^M" at the end. Does anyone know why ? Here is my 
> code ?
> 
> os.system("../syn/pin_assign.pl customer_netlist.txt")
> shutil.copy("../fileB", "fileB")
> ucf = open("fileB", "a")
> pin = open("fileA", "r")
> ucf.write(pin.read())
> ucf.close;
> pin.close;
> sys.exit(0);
> 
> Here is what I get.
> 
> # FPGA CLOCK^M
> NET "SYSCLK_A"  loc = N16  | TNM_NET = SYSCLK_A;^M
> NET "SYSCLK_AN" loc = M16  | TNM_NET = SYSCLK_A;^M
> 

Looks like a problem with newline format. Googling for "universal 
newline" may be a good start.



More information about the Python-list mailing list