Re: appending file



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.
.



Relevant Pages

  • Re: appending file
    ... Kuo wrote: ... I'm trying to read a file (fileA) and append to another file. ... GPG key: 0xF421434B may be found on various keyservers, ...
    (comp.lang.python)
  • Re: How do you tag one file onto the end of another?
    ... However, if filea is huge, this takes a noticeable time, because ... the entirety of filea is copied to filec (followed by fileb, ... you can just append things to ... will append fileb to filea - but only if it's a text file. ...
    (microsoft.public.windowsxp.newusers)
  • How do you tag one file onto the end of another?
    ... However, if filea is huge, this takes a noticeable time, because the entirety of filea is copied to filec (followed by fileb, obviously). ... you can just append things to another file - e. ...
    (microsoft.public.windowsxp.newusers)
  • Re: How do you tag one file onto the end of another?
    ... However, if filea is huge, this takes a noticeable time, because ... the entirety of filea is copied to filec (followed by fileb, ... you can just append things to ...
    (microsoft.public.windowsxp.newusers)