Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
comparing 2 lists
#1
Hi,

I have problem comparing 2 lists. one list has 10 records and the other have less than 10 so it is between 1 and 9 records. What I am trying to accomplish is to compare the 2 lists and create new empty list to hold the missing items. Example:

        for rec in records2:
            questions.append(rec[4])

        for record in records:
            questions2.append(record[0])
First List has list of let us say [1,3,5,6,7]
Second List has list of [1,2,3,4,5,6,7,8,9,10]
so I need to compare them and get a new list that has [2,4,8,9,10]

thanks.
Reply


Messages In This Thread
comparing 2 lists - by rwahdan - Jul-18-2021, 05:37 PM
RE: comparing 2 lists - by Yoriz - Jul-18-2021, 06:24 PM
RE: comparing 2 lists - by DeaD_EyE - Jul-18-2021, 06:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Split dict of lists into smaller dicts of lists. pcs3rd 3 2,312 Sep-19-2020, 09:12 AM
Last Post: ibreeden
  Comparing items from 2 lists of dictionaries illwill 7 2,666 Sep-14-2020, 10:46 PM
Last Post: bowlofred
  sort lists of lists with multiple criteria: similar values need to be treated equal stillsen 2 3,190 Mar-20-2019, 08:01 PM
Last Post: stillsen
  Comparing values in separate lists KaleBosRatjes 3 2,981 May-02-2018, 04:38 PM
Last Post: KaleBosRatjes

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020