Hello,

I am coming back to Python after quite a long time, have forgotten everything, and don't know anything of python 3. I use python 3.3 for its nice unicode text type.

=== codes ===

What is the method to get a code or list of codes inside a string:
        s = "abcde"
        c = s.code(2)
        assert(c == 0x63)
?

=== sub compare ===

Is there a method to compare a substring, without building a substring from the big one? Like startswith or endswith, but anywhere inside the string?
        test = s[1, -1] == "bcd"      # no!, builds a substring
        test = s.sub_is(1, -1, "bcd") # yes! what I'm searching

If this method does not exist, what do you think of it? (Well, the name is not great, but could not find better ;-)

Thank you,
Denis
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to