appending file

Kuo chinchia.kuo at sbcglobal.com
Fri Jun 29 21:04:28 CEST 2007


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


Note that if I don't do "ucf.write(pin.read())", everything is ok.

Thanks for any help.



More information about the Python-list mailing list