I am new to Python and trying to learn python from Perl. In Perl, if I want to compare a string against multiple sub-strings, I would use the following:
sub matchCity {
my $cityName = shift;
print "$cityName is a valid city name\n" if ($cityName =~ /kyo|par|omba/);
}
matchCity('tokyo'); # tokyo is a valid city name
matchCity('paris'); # paris is a valid city name
matchCity('bombay'); # bombay is a valid city name
matchCity('chicago'); # Doesn't print anything
How can I do this in python?