substring matching

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • M.N.A.Smadi

    #1

    substring matching

    hi;

    say i have the following variable

    data="""XYZ dflsjdfkl sdfsdhfl
    jdsflkdsjf
    sldjfsldjf
    """

    i need to make sure that the first part is actually XYZ, is there an
    easy way of doing that?

    thanks
    m.smadi
  • Roel Schroeven

    #2
    Re: substring matching

    M.N.A.Smadi wrote:[color=blue]
    > hi;
    >
    > say i have the following variable
    >
    > data="""XYZ dflsjdfkl sdfsdhfl
    > jdsflkdsjf
    > sldjfsldjf
    > """
    >
    > i need to make sure that the first part is actually XYZ, is there an
    > easy way of doing that?[/color]

    data.startswith ("XYZ")

    --
    "Codito ergo sum"
    Roel Schroeven

    Comment

    Working...