Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Zachary Ware Newsgroups: comp.lang.python Subject: Re: ignoring or replacing white lines in a diff Date: Thu, 14 Jan 2016 14:54:24 -0600 Lines: 12 Sender: zachary.ware@gmail.com Message-ID: References: <5697f08f$0$23822$e4fe514c@news.xs4all.nl> <5698118F0200001B0003B68D@gwsmtp1.astron.nl> Reply-To: python-list@python.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de B/W9jkr6QfhP4nyqq0bAZgd9h5k4cv5Keb74n0k0D1Hg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'diff': 0.05; 'behave': 0.09; 'skip:` 30': 0.09; 'jan': 0.11; 'thu,': 0.15; '2016': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subprocess,': 0.16; 'wrote:': 0.16; 'sender:addr:gmail.com': 0.18; 'skip:l 30': 0.18; 'cc:2**0': 0.20; 'to:name:python-list@python.org': 0.20; 'trying': 0.22; '(you': 0.23; "python's": 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; '14,': 0.27; 'specify': 0.27; 'url:python': 0.33; 'particular,': 0.33; 'received:google.com': 0.35; 'instead': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'url:library': 0.36; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'received:209.85.214': 0.39; 'to:addr:python.org': 0.40; 'url:3': 0.60; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'reply-to:addr:python.org': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=s7XESIV0vUv7QCZ/Elxt3k8psLtFMnQaaNROMgd+b60=; b=gWHHsmsTxGSnI3n1Z04XDGlwUI7HVtRFVUBSLStvJ5Eke3ChnFD7tDt7C+HjajvvBj B8F995hdueG++mUyY+gDc1IPlmxwAJPryaDu6rrwnT9zrFV6P3NBPC2EI3m13dwLgUWq /h1zJgfRtUGKS7YXj3AccUL8zC4BZWNpLan3Bj+AEmTzjqIySReRiPIHaNU+pe01s1Nm lZC2MR9CTJqgc094uOZpOUp+tl1NmTwBBTf78tbi2sEaM030ZXvDKRwkBJhyZG4cjz90 5oeUksxjQ9oHx6+er1bAE62IwFCsuer4P62h9qb0a9BL5vfP/5Jfjta350H9qLVeAKN4 rS2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=s7XESIV0vUv7QCZ/Elxt3k8psLtFMnQaaNROMgd+b60=; b=JWJXb6AN6N+AdLiJ9lGlpwSbANt7++zRgYoRlJzY92CeMJb5R1NeLPvLyEHeHr4lKz bvW6QNbRNakCSn5hU5Xg6lyGGVTH30g6xw4I1T/FNigiBebHHZxYKXPAEG8riGhlxbW+ BkBpbvJ1G9Bkn7wY5WekpHnYYuucPfNfMVFh79fDScL97RGa1XJS5YPhraA6b07Q+4Ks z9MmieLLwshJl2ioUEKFlBfYzGQnz42ql0cv4OEzZR8VZDu4MBPdTWsHiVY5PH9RyTHL pZQekyHALcpv1d7JRBKzfOcyrall1r9uZyVG3dYjzZ3F7r7Sb9l/udq9piDgH/0iLWqF wFvw== X-Gm-Message-State: ALoCoQl0UEkarc197azCYHAcHTj9oR00fmsgNY8/C8qrWD205z5CyPb22AzjPVEj0hdQZ2DKeG7YcILSJSjdbK2ppB+gdO9+Jg== X-Received: by 10.182.236.3 with SMTP id uq3mr5074703obc.25.1452804884259; Thu, 14 Jan 2016 12:54:44 -0800 (PST) In-Reply-To: <5698118F0200001B0003B68D@gwsmtp1.astron.nl> X-Google-Sender-Auth: t_HC9NDqTjGVKapyBcL3mveer2A X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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:101713 On Thu, Jan 14, 2016 at 2:22 PM, Adriaan Renting wrote: > Any suggestions? Instead of trying to make diff behave through subprocess, have a look at Python's difflib: https://docs.python.org/3/library/difflib.html In particular, I think `difflib.ndiff(first_list_of_strings, second_list_of_strings, linejunk=difflib.IS_LINE_JUNK)` might be what you're looking for (you may not even need to specify linejunk). -- Zach