Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ganesh Pal 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: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de ErEX4SMWEFitFx3EH7Cp8QMZKCh5xjr8PV18HfPoXglQ== Return-Path: 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: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103591 Thanks it works fine :) On Fri, Feb 26, 2016 at 5:01 PM, Peter Heitzer wrote: > Ganesh Pal 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