On Jun 5, 12:04 pm, Shanata Hadi <[email protected]> wrote:
> On Wed, Jun 03, 2009 at 05:59:14PM -0700, zimxbim wrote:
> > pertanyaan 1:
> > bagaimana cara menggabungkan ke dua isi file a.txt dan b.txt
> > bersebelahan, menjadi file c.txt ?
> > contoh output setelah dibagung kedalam file c.txt:
> > satu satu
> > tiga empat
> > lima enam
> > tujuh tujuh
> > delapan
>
> #!/usr/bin/env python
>
> import sys
>
> a = open(sys.argv[1]).readlines()
> b = open(sys.argv[2]).readlines()
>
> for x,y in zip(a,b):
> print '%s %s' % (x.strip('\n'), y.strip('\n'))
>
> combine.py a.txt b.txt > c.txt
>
> modifikasi dikit biar delapannya masuk hehehe :D
> yg ke 2 jd bahan latihan :p
untuk no.1 ternyata cukup dgn command paste :)
paste a.txt b.txt > c.txt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Klub
Linux Bandung" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/klub-linux-bandung?hl=en
-~----------~----~----~----~------~----~------~--~---