How to compare the Operators?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • psbasha
    Contributor
    • Feb 2007
    • 440

    #1

    How to compare the Operators?

    Hi ,

    while reading file I have to compare/check for the equal operator "=", and after this I have to collect the other data.

    How to compare / check this operators?

    Thanks in advance
    PSB
  • ghostdog74
    Recognized Expert Contributor
    • Apr 2006
    • 511

    #2
    Originally posted by psbasha
    Hi ,

    while reading file I have to compare/check for the equal operator "=", and after this I have to collect the other data.

    How to compare / check this operators?

    Thanks in advance
    PSB
    there are, assuming you want to check the "=" character
    1) use the "==" equality operator.
    eg
    Code:
    if ch == "=":
    2) use "in"
    Code:
    if "=" in line:
    Post some sample data if possible.

    Comment

    • psbasha
      Contributor
      • Feb 2007
      • 440

      #3
      SET 10 = 1101 1106 1107 1108 1109 1110 1111,

      I have to compare the equal to "=" with in the string above and get the other numbers.So how to proceed with this

      Comment

      • ghostdog74
        Recognized Expert Contributor
        • Apr 2006
        • 511

        #4
        Originally posted by psbasha
        SET 10 = 1101 1106 1107 1108 1109 1110 1111,

        I have to compare the equal to "=" with in the string above and get the other numbers.So how to proceed with this
        Assuming this line is from ae file, so iterating over the file
        Code:
        for line in open("file"):
            if "=" in line:
                ......

        Comment

        Working...