FAQ
Hi there,


I am researching a nice slick way to provide the difference between
generated python multi-line configuration output and specific
configuration lines gathered from an output file. I could put things in
a list? I could put both forms output into IOString() and run a diff
command to it?


What are some options that work well?


Cheers,


Noah

Search Discussions

  • Peter Otten at Sep 11, 2015 at 7:03 am

    Noah wrote:


    I am researching a nice slick way to provide the difference between
    generated python multi-line configuration output and specific
    configuration lines gathered from an output file. I could put things in
    a list? I could put both forms output into IOString() and run a diff
    command to it?

    There's difflib in Python's standard library:

    import difflib
    print("".join(difflib.unified_diff(
    ... ["foo\n", "bar\n", "baz\n"],
    ... ["foo\n", "baz\n", "bang\n"])))
    ---
    +++
    @@ -1,3 +1,3 @@
      foo
    -bar
      baz
    +bang

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedSep 11, '15 at 12:41a
activeSep 11, '15 at 7:03a
posts2
users2
websitepython.org

2 users in discussion

Noah: 1 post Peter Otten: 1 post

People

Translate

site design / logo © 2019 Grokbase