查找字符串匹配模式

时间:2015-12-25 05:23:37

标签: python regex string-split

我有这样的模式:

pattern = "Delivered to %(recipient)s at %(location)s"

如何根据此模式获取字符串的recipientlocation

例如:Delivered to Mr.Smith at Seattle将被提取到[Mr.Smith,Seattle]

因此,我希望任何匹配此模式的字符串都会像这样提取这两个参数。

1 个答案:

答案 0 :(得分:2)

#include <stdio.h>

int main(void)
{
    double s;
    int a;
    scanf("%lf%d", &s, &a);
    if (_________________ )
         __________________
         _________________
         _________________
    else
        __________________
        __________________
        ________________
        __________________
        return 0; }