K
Ken D'Ambrosio
Hi, all. As a recovering Perl guy, I have to admit I don't quite "get"
the re module. For example, I'd like to do a few things (I'm going to use
phone numbers, 'cause that's what I'm currently dealing with):
12345678900 -- How would I:
- Get just the area code?
- Get just the seven-digit number?
In Perl, I'd so something like
m/^1(...)(.......)/;
and then I'd have the numbers in $1 and $2, respectively. But the Python
stuff simply isn't clicking for me. If anyone could supply concrete
examples of how to do the problem, above, that would be terrific.
Thanks!
-Ken
the re module. For example, I'd like to do a few things (I'm going to use
phone numbers, 'cause that's what I'm currently dealing with):
12345678900 -- How would I:
- Get just the area code?
- Get just the seven-digit number?
In Perl, I'd so something like
m/^1(...)(.......)/;
and then I'd have the numbers in $1 and $2, respectively. But the Python
stuff simply isn't clicking for me. If anyone could supply concrete
examples of how to do the problem, above, that would be terrific.
Thanks!
-Ken