web-dev-qa-db-fra.com

Recherche des populations d'une liste de villes

Je veux créer une liste de toutes les villes du monde nommées "Alexandrie", avec leurs populations. Un moteur de recherche peut-il le faire? A quoi pourrait ressembler la requête?

1
Hosam Aly

Mathematica pourrait répondre à cela par CityData :

data=CityData["Alexandria"];
Table[{data[[i]],CityData[data[[i]],"Population"]},{i,1,Length[data]}]

Donnant la sortie suivante:

{
{{Alexandria,Alexandria,Egypt},4230569},
{{Alexandria,Virginia,UnitedStates},139966},
{{Alexandria,Piemonte,Italy},90446},
{{Alexandria,Kirovograd,Ukraine},88916},
{{Alexandria,Teleorman,Romania},51737},
{{Alexandria,Louisiana,UnitedStates},47723},
{{Alexandria,Imathia,Greece},13665},
{{Alexandria,WestDunbartonshire,UnitedKingdom},13480},
{{Alexandria,Minnesota,UnitedStates},11070},
{{Alexandria,RioGrandeDoNorte,Brazil},9769},
{{Alexandria,Kentucky,UnitedStates},8477},
{{Alexandria,Indiana,UnitedStates},5145},
{{Alexandria,NewYork,UnitedStates},4061},
{{Alexandria,Alabama,UnitedStates},3917},
{{Alexandria,Ontario,Canada},3559},
{{Alexandria,SaintAnn,Jamaica},1927},
{{Alexandria,NewHampshire,UnitedStates},1613},
{{Alexandria,Tennessee,UnitedStates},966},
{{Alexandria,SouthDakota,UnitedStates},615},
{{Alexandria,Ohio,UnitedStates},517},
{{Alexandria,Pennsylvania,UnitedStates},346},
{{Alexandria,Nebraska,UnitedStates},177},
{{Alexandria,Missouri,UnitedStates},159}
}

Malheureusement, la liste des sorties, accessible par CityData["Alexandria"] dans Mathematica, n’est pas disponible dans Wolfram | alpha pour le moment.

2
Gareth

Un moteur de recherche ne serait pas un moyen efficace de réaliser ce que vous voulez, car il ne ferait pas la distinction entre différents Alexandria. Voir plutôt l'article de Wikipedia sur Alexandria http://en.wikipedia.org/wiki/Alexandria_ (homonymie) et cliquez sur les liens de l'article pour voir la population de chaque lieu.

1
David