omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. cloudytechi147

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    cloudytechi147

    @cloudytechi147

    A tech guy loves to code and teach the same.

    0
    Reputation
    295
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    cloudytechi147 Unfollow Follow

    Latest posts made by cloudytechi147

    • How to check that a key has exactly 1 value in a dictionary?

      I have this python copy directory:

      {128: ['S', 'S', 'O', 'F'], 512: ['S', 'F']}
      

      I would like to be sure that each key has exactly one value 'F' and one value 'S' and return a message if it's not the case

      I tried this but it didn't seem to work: it didn't print the message

      for key in d:
          if not re.search(r"[F]{1}","".join(d[key])) or not re.search(r"[S].{1}","".join(d[key])):
              print(f"There is no start or end stop for the line {i}.")
      

      Thanks in advance

      posted in Pythonista
      cloudytechi147
      cloudytechi147