[Python-de] cat in python

"Martin v. Löwis" martin at v.loewis.de
Don Mar 30 21:00:22 CEST 2006


Roland M. Kruggel wrote:
> Ich suche für folgenden bash-Aufruf das äquivalent in python
>   cat *.4go > xxx.4gi

import glob, shutil

outfile = open("xxx.4gi", "w")
for f in glob.glob("*.4go"):
  infile = open(f)
  shutil.copyfileobj(infile, outfile)
  infile.close()
outfile.close()

HTH,
Martin