[Tutor] Re: perl's chomp equivalent?
Tim Condit
timc@ans.net
Mon, 17 Jul 2000 17:21:35 -0400 (EDT)
oops, one small typo.. should be:
merge_file = union(file1, file2)
(not that it's terribly relevant to the question anyway.. :)
thanks,
Tim Condit
UUNet Network Quality Services
734-214-7548
tcondit@uu.net
On Mon, 17 Jul 2000, Tim Condit wrote:
>
> Hi,
>
> Is there anything similar to perl's chomp, which removes newline
> characters from the end of a line? I'm using this, which works just fine
> if not..
>
> --
>
> def main():
> file1 = re_proc(sys.argv[1], p1)
> file2 = re_proc(sys.argv[2], p1)
> merge_file = union(a, b)
>
> for i in range(len(merge_file)):
> if merge_file[i][-1] == "\n":
> print merge_file[i][:-1]
> else:
> print merge_file[i]
>
> --
>
> thanks,
> Tim Condit
> UUNet Network Quality Services
> 734-214-7548
> tcondit@uu.net
>
>
>