Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103591

Re: How to remove the line numbers from the file in python

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ganesh Pal <ganesh1pal@gmail.com>
Newsgroups comp.lang.python
Subject Re: How to remove the line numbers from the file in python
Date Sat, 27 Feb 2016 22:08:40 +0530
Lines 14
Message-ID <mailman.180.1456591123.20994.python-list@python.org> (permalink)
References <mailman.145.1456484839.20994.python-list@python.org> <djarckFeuqsU1@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de ErEX4SMWEFitFx3EH7Cp8QMZKCh5xjr8PV18HfPoXglQ==
Return-Path <ganesh1pal@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:file': 0.07; 'cc:addr:python-list': 0.09; 'subject:How': 0.09; 'python': 0.10; 'subject:python': 0.14; '2016': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:remove': 0.16; 'wrote:': 0.16; 'pfxlen:0': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'feb': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'fine': 0.28; 'subject:numbers': 0.29; 'print': 0.30; 'url:mailman': 0.30; 'url:python': 0.33; 'url:listinfo': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'easiest': 0.35; 'url:org': 0.36; 'lines': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'received:209': 0.38; 'subject:from': 0.39; 'subject:the': 0.39; 'url:mail': 0.40; 'leading': 0.61; '26,': 0.72
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=MT9wDQBodxllZR8asIuixMX2frgJnzPC6XUs8+hnW8Q=; b=DpsN9AeWkhf7bL46upp1hngqrp4j88pjC7DfCDtuYTdIMYShfwHvwws2QmSf80Xg/3 s68uFIoEr/z4emHybbSUYVO1zSkuPDf3hgoDIicsIFcBcWFbdc14AzT+dJveqKgJvgQV OnbrgYcynb9jRpkNeBSktfvGIhXARXIsZ4W3QQ/hyCsg3NP0fYMx5nfRyZE7hv9aAAei EiMLNfktgzZQFEvF0cZ9zJm3EWvr01j2rM3h7vSYTaV2zla02ze2HTp1TckL8oJqNnU2 STmpyDVeBR7QZVWoF8u13SUhIZX1xJFTI99TSQBFCSIznGZ/wlFQ225XGkAZpfpVQBMh z1Og==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=MT9wDQBodxllZR8asIuixMX2frgJnzPC6XUs8+hnW8Q=; b=SeCH0WYCgnqYHfwuwdhjBFkI4pO1xR0bAn9Y2oZb68ZGIczFb6fGN0AduFn5qQy8VH W5etdAgI7GlECx2ecoat3Xo8+o/ewCwrK4YdRfpNn5gptZEaHX7wqRNpFrd7+qIInxd7 R9ZiJa698bsD3/41MGpKMwg/M7k67iZQvw6IeTaFGBQIJ5vmlT5KY1gWqaaY2s2GROEI qz848NxygQQ72/SvFLaO82mklKBRGwk6CarA7LgL5dhKyOE4BAkxoGO+Jd8Vkyf0oNsw ScqRck0kUqCJnH59lUP0PjuxEeX3D58vYYu8O50/FjGvI2lyRaRE/6hEAxagmabjYA0h GZ4A==
X-Gm-Message-State AD7BkJKzyTHFstBH+V2tZF6RkLdm5y7eWbTUQ5s+4KNH+RHLeezJi1f+gL4moiJENV8a0eVk3GFWtXy+wyDGZA==
X-Received by 10.112.14.102 with SMTP id o6mr2531354lbc.87.1456591120653; Sat, 27 Feb 2016 08:38:40 -0800 (PST)
In-Reply-To <djarckFeuqsU1@mid.individual.net>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103591

Show key headers only | View raw


Thanks it works fine :)


On Fri, Feb 26, 2016 at 5:01 PM, Peter Heitzer
<peter.heitzer@rz.uni-regensburg.de> wrote:
> Ganesh Pal <ganesh1pal@gmail.com> wrote:
>>what would be the easiest way to remove the lines in the leading
>>numbers 1.e 1 ,2,.... 19  from this file  using python ?
> import sys,re
> for line in sys.stdin:
>         print re.sub('^\d+','',line).rstrip()
>
> --
> https://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How to remove the line numbers from the file in python Ganesh Pal <ganesh1pal@gmail.com> - 2016-02-26 16:37 +0530
  Re: How to remove the line numbers from the file in python "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2016-02-26 11:31 +0000
    Re: How to remove the line numbers from the file in python Ganesh Pal <ganesh1pal@gmail.com> - 2016-02-27 22:08 +0530

csiph-web