streetList = [ "13 Kent Street Gordon", "22 King Road Soho", "123 Kong Lane Foggy Bottom", "76 Inglis Avenue Don't Go Here", "300 4th Street Adams Morgan"] kindList = ["Street", "Road", "Lane", "Avenue", "Trail"] newList = [] for street in streetList: for kind in kindList: if kind in street: where = street.find(kind) kindLen = len(kind) div = where + kindLen streetPart = street[:div] suburbPart = street[div:] newList.append([streetPart, suburbPart]) print newList
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.