Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8112281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:26:23+00:00 2026-06-06T02:26:23+00:00

I am a newbie to python and just learning things as i do my

  • 0

I am a newbie to python and just learning things as i do my project and here i have two list of list which i need to compare and separate the diff found in A — > B and diff found b –> A
What is the best way of comparing.

A=[[1L, 'test_case_1'], [1L, 'test_case_2'], [2L, 'test_case_1']]
B=[[1L, 'test_case_1'], [1L, 'test_case_4'], [2L, 'test_case_1'], [2L, 'test_case_3']]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:26:25+00:00Added an answer on June 6, 2026 at 2:26 am

    Assuming you can use a list of tuples as per my comment, this simple modification of Junuxx’s answer is much more efficient

    A – B:

    >>> setb = set(B)
    >>> [x for x in A if not x in setb]
    [(1L, 'test_case_2')]
    

    B – A:

    >>> seta = set(A)
    >>> [x for x in B if not x in seta]
    [(1L, 'test_case_4'), (2L, 'test_case_3')]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a newbie on python. I have just create a program taking a
newbie python programmer here. I have written a script and want to modify the
I'm a Python newbie. I have a series of objects that need to be
I'm newbie for python, I'm having task so I need to scan wifi and
I'm newbie in Python. I have this simple code a = 0 b =
I'm a newbie in Python and I'm studying list comprehension. What I'm trying to
I am learning Python and building my first web app. I have been going
Python newbie here and wanted to know if there was a way to combine
I am just learning python and Qt these days. So please consider that this
I am a newbie - just reached the end of Learn Python the Hard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.