Python Forum
Tuple comprehension to for loop help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tuple comprehension to for loop help
#3
Thank you for your reply.
I was finally able to get some meaningful help from the class.
def get_password_leaks_count(hashes, hash_to_check):
    splithashes = hashes.text.splitlines()
    newlist = []
    for line in splithashes:
        newlist.append(line.split(':'))
        for h, count in newlist:
            if h == hash_to_check:
                return count
        return 0
        print(h, count)
However, there is a weird problem now. Last night, this functioned well just like the original, but today, it is just letting any password pass by as being safe.
Reply


Messages In This Thread
Tuple comprehension to for loop help - by jsuh21 - Aug-31-2020, 05:55 AM
RE: Tuple comprehension to for loop help - by jsuh21 - Sep-01-2020, 09:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question mypy unable to analyse types of tuple elements in a list comprehension tomciodev 1 530 Oct-17-2023, 09:46 AM
Last Post: tomciodev
  For Loop with List Comprehension muzikman 25 6,943 Dec-18-2020, 10:45 PM
Last Post: muzikman
  code with no tuple gets : IndexError: tuple index out of range Aggam 4 2,915 Nov-04-2020, 11:26 AM
Last Post: Aggam
  Help: list comprehension for loop with double if statement mart79 3 2,496 May-04-2020, 06:34 AM
Last Post: buran
  List comprehension. Shor for loop version dervast 1 1,633 Dec-11-2019, 12:34 PM
Last Post: perfringo
  Arrange list of tuple using loop batchenr 7 3,566 Jun-16-2019, 03:24 PM
Last Post: Abdullah
  How to get first line of a tuple and the third item in its tuple. Need Help, Anybody? SukhmeetSingh 5 3,308 May-21-2019, 11:39 AM
Last Post: avorane

Forum Jump:

User Panel Messages

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