1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How do I compare two strings using a for loop?

Discussão em 'Python' iniciado por Stack, Novembro 30, 2025.

  1. Stack

    Stack Membro Participativo

    I'm building a simple email verifier. I need to compare the local-parts current letter to a list of valid characters. So essentially I'm asking how do I check to see if the current letter I'm on in local-part is equivalent to a letter in the ENTIRE list of valid chars. If it is a valid character, local-part will go to the next letter in its string and go through the list of valid characters to see if this too is and so on until it reaches the @ symbol unless there isn't a valid character.

    I'm fairly new to python so I don't know how nested for loops work.

    for ch in local:
    for ch in valChar:
    if(ch ==ch) <----problem


    This is what I currently have written for the loops. Is "ch" a variable or some type of syntax to represent char?

    Continue reading...

Compartilhe esta Página