python 2.7 - Turning my web scrape data into an array -


the following code below pulls information want; however, want sorted array each phone number paired corresponding name, address, , description. can't figure out way indent make pull 38 entries. appreciated!

#import libraries selenium import webdriver import csv #driver path driver = webdriver.chrome('c:\python27\chromedriver\chromedriver.exe') #fetch top amsterdam restaurants driver.get('http://www.eater.com/maps/best-amsterdam-restaurants')  elem in driver.find_elements_by_xpath('.//h2[span[@class = "c-mapstack__card-index"]]'):     restname = elem.text address in driver.find_elements_by_class_name('c-mapstack__address'):     restaddress = address.text content in driver.find_elements_by_class_name('c-entry-content'):     restdescrip = content.text eaterarray = [restname, restaddress, restdescrip] print eaterarray 

i aware indenting isn't right, , i've tried several configurations can't seem loop right in configuration.

first of inform if not want provide path of chromedriver in each script, paste "chromedriver.exe" under scripts folder of python..i.e,"c:\python27\scripts"

try code, solve problem:

from selenium import webdriver  driver = webdriver.chrome() driver.maximize_window()  #fetch top amsterdam restaurants driver.get('http://www.eater.com/maps/best-amsterdam-restaurants')  a=[] b=[] c=[]  elem in driver.find_elements_by_xpath('.//h2[span[@class = "c-mapstack__card-index"]]'):     restname = elem.text.encode('ascii', 'ignore')     a.append(restname)  address in driver.find_elements_by_class_name('c-mapstack__address'):     restaddress = address.text.encode('ascii', 'ignore').strip()     b.append(restaddress) content in driver.find_elements_by_class_name('c-entry-content'):     restdescrip = content.text.encode('ascii', 'ignore').strip()     c.append(restdescrip)  q=[(x,y) x,y in zip(b, b[1:]) if '+31' in y]   q.insert(21,'raadhuisstraat amsterdam, netherlands') q.insert(25,'leidsestraat 94 amsterdam, north holland 1017 pe, netherlands') d=c[1:]  new_dict= dict((a[i], (d[i],q[i])) in range(len(a)))  k, v in new_dict.iteritems():     print k , v 

it print output as:

22 haringstal ab kromhout ("contrary popular belief, dutch herring not raw salt-cured  although complex curing process give raw finish on tongue. first of season herring called hollandse nieuwe , available starting in june. can find herring stalls on city, haringstal ab kromhout come highly recommended. order 1 au naturel or go traditional raw chopped onion , pickle accompaniment. can't make ab kromhout? kras haring on wittenburgergracht excellent option. [$]", 'raadhuisstraat amsterdam, netherlands') 25 foodhallen ('formerly tram depot, de foodhallen place taste of dutch street food scene. theres here: grilled cheese sandwiches (at caulils), bitterbal tasting (at de ballenbar), burgers (at butcher), hotdogs (at bulls & dogs), vietnamese street food (at viet view), bbq pork (at rough kitchen), sweet tartlets (at le petit gateau), mediterranean snacks (at maza), , lots more. [$$]', ('bellamyplein 51\n1053 @ amsterdam, netherlands', '+31 6 29265037')) 3 rotisserie rijsel ('rijsel serves flemish , french classics boeuf  la mode, huzarensalade (russian salad), presskop (head cheese), , rotisserie poussin, prepared finest ingredients.  combined well-chosen , well-priced wine selection  has put rijsel on everybodys favourite list since opening in 2012. booking ahead essential , (if on offer) dont think twice ordering cte de boeuf. [$$$]', ('marcusstraat 52b\namsterdam, noordholland 1091tk, netherlands', '+31 20 463 2142')) 9 bord'eau - restaurant gastronomique ('if can afford it, head two-michelin-starred bordeau ultimate fine-dining experience. here, chef richard van oostenbrugge wows guests incredibly skilled, classic technique-based cooking. expect finest produce, maximum flavors, exquisite sauces, , picture-perfect plates. in fact, bordeaus signature apple dessert photographed/instagrammed dessert in amsterdam. [$$$$]', ('nieuwe doelenstraat 2\namsterdam, north holland 1012 cp, netherlands', '+31 20 531 1705')) 10 oriental city ('located in amsterdams wallen area, oriental city firm favorite locals , amsterdams chinese community alike. youll tempted of extensive menu, , oriental citys dim sum among best in amsterdam. restaurant has many tables divided on 2 floors, still prepared stand in line on saturdays. [$$$]', ('oudezijds voorburgwal 177-179\namsterdam, north holland 1012 ev, netherlands', '+31 20 626 8352')) 4 la rive ('an amsterdam fine-dining institution since 90s (and once home of renowned dutch chef robert kranenborg), since 2008, rogr rassin has been @ helm of la rives kitchen. dont fooled traditional, ever-so-slightly formal dining room, because, au contraire, rassins cooking deliciously modern , seasonal. dinner-only restaurant has unique riverside location, try book window table. [$$$$]', ('professor tulpplein 1\namsterdam, north holland 1018 gx, netherlands', '+31 20 520 3264')) 11 restaurant gebr. hartering ('part of amsterdams new wave of casual , unpretentious restaurants, gebr hartering has helped shape citys lively dining scene. eatery run brothers paul , niek hartering , concept simple: hearty food cooked great ingredients, enjoyed glass of fine wine. theres daily-changing menu, includes big-hitter fleckvieh beef, grilled on charcoal. [$$$]', ('peperstraat 10i\n1011 tl amsterdam, netherlands', '+31 20 421 0699')) 12 nam kee ('one of amsterdams longest-running chinese restaurants, nam kee best known peking duck window display , famous steamed oysters in black bean sauce  fantastic oysters owe fame dutch film (and novel) oysters @ nam kees. [$$$]', ('zeedijk 111-113\namsterdam, north holland 1012 av, netherlands', '+31 20 624 3470')) 15 gebroeders niemeijer ('start day cup of coffee (featuring costadora beans) , freshly-baked croissant @ gebr. niemeijer bakery, or order 1 of french-style breakfasts, petit pains, croissants, marmalade, , jam. @ lunchtime, gebr. niemeijer serves simple sandwiches , salads. theres great selection of baked goods, , dont miss out on baguettes (you know, vondelpark picnic). [$]', ('nieuwendijk 35\namsterdam, north holland, netherlands', '+31 20 707 6752')) 17 toscanini ('toscanini most-loved italian restaurant in amsterdams jordaan, , 30-year history, 1 of oldest, too. no pizzas here: instead, expect proper (seasonal) italian menu choice of antipasti, primi, secondi, , dolci. toscanini offers non-fussy food great ingredients , maximum flavor, served in wonderfully bustling setting. great dinner spot  , theres excellent wine list, too. [$$$]', ('lindengracht 75\namsterdam, north holland 1015 kd, netherlands', '+31 20 623 2813')) 26 febo ('amsterdam famous deep-fried snacks kroket , bitterballen (both similar croquettes) , frikandel, type of sausage. @ 75-year-old fast food chain febo can buy these snacks automat. there branches scattered on city, shouldnt difficult teeth frikandel or kaassouffl, pocket of deep-fried cheese. on fridays , saturdays branches open until 4 a.m., perfect wee-hour drunken munchies. [$]', 'leidsestraat 94 amsterdam, north holland 1017 pe, netherlands') 14 restaurant stork ('hop on ijplein ferry (near central station) lunch or dinner @ stork, housed in former stork engines factory building on north banks of river ij. order sole or lobster fries or tuck delicious plateau fruit de mer , enjoy great views of river. storks riverside terrace offers wonderful al fresco dining experience. [$$]', ('gedempt hamerkanaal 201\namsterdam, north holland 1021 kp, netherlands', '+31 20 634 4000')) 19 proeflokaal arendsnest ('for taste of burgeoning dutch craft beer scene, seat @ bar @ arendsnest. @ canal-side beer bar on herengracht, can try on 30 dutch beers on tap , no fewer 100 bottled beers. youll spoiled choices, try 1 of jopen brewerys award-winning beers, particularly stout, won gold medal in 2015 world beer awards. [$]', ('herengracht 90\namsterdam, north holland 1015 bs, netherlands', '+31 20 421 2057')) 30 thrill grill ('with first-rate burgers, thrill grill has rapidly become household name real burger lovers. thrill grill brainchild of veteran chef robert kranenborg, local legend. meat old dutch dairy cows , cooked medium-rare. teeth classic beef thriller or go salmon or veggie falafel burger. branch on gerard doustraat provides particularly lovely ambiance. [$$]', ('gerard doustraat 98\namsterdam, north holland 1072vx, netherlands', '+31 20 760 6750')) 27 patisserie holtkamp ('a family-owned pastry shop amsterdam locals go sweet treats, expect patisserie holtkamp offer small superb range of french , dutch patisserie, cakes, chocolates, , biscuits (no cupcakes here!). holtkamp famous veal, shrimp, , cheese kroketten (croquettes), deep-fried order in shop. [$]', ('vijzelgracht 15\namsterdam, north holland 1017, netherlands', '+31 20 624 8757')) 2 brouwerij 't ij ('this amsterdam brewery has unique canal-side location, right next old windmill, , outdoor terrace popular hangout on sunny days. around 7 beers available on tap, including classic zatte , natte , special seasonal brew, too. small selection of bar snacks on offer, including traditional dutch ossenworst, raw , smoked beef sausage. [$]', ('funenkade 7\namsterdam, north holland 1018 al, netherlands', '+31 20 320 1786')) 24 fromagerie kef ('cheesemonger fromagerie abraham kef supplies many michelin-starred restaurants in amsterdam cheese. original shop (est. 1953) on marnixstraat, since 2014, second branch operates on czaar peterstraat. on sundays marnixstraat branch regularly organizes cheese , wine tastings. kefs fantastic cheese selection (mainly made raw milk) includes magnificent aged dutch cheeses. dont leave without remeker. [$]', ('marnixstraat\namsterdam, north holland 1016 tj, netherlands', '+31 20 420 0097')) 18 cafe de klepel ('quality wines , bistro food take spotlight @ caf de klepel, part of recent dutch bistronomie movement. friendly , popular place run young sommelier duo margot los , job seuren (formerly of de librije). pop in glass of wine (at bar) charcuterie or cheese. full experience, book table , order de klepels three-or four-course menu. [$$]', ('prinsenstraat 22\namsterdam, north holland 1015 dd, netherlands', '+31 20 623 8244')) 36 yamazato ('yamazato provides unexpected slice of japan in dutch capital, including dining room views of japanese garden koi pond. in evenings, michelin-starred yamazato  in hotel okura  offers authentic kaiseki tasting menus, can step in lunch , order bento box or great value lunch menu (five courses 50).  la carte menu including sushi , sashimi available, too. [$$$-$$$$]', ('ferdinand bolstraat 333\namsterdam, north holland 1072 lh, netherlands', '+31 20 678 8351')) 38 ron gastrobar ('amsterdams thriving dining scene owes lot ron blaauw. 3 years ago, relaunched two-star restaurant more casual , wallet-friendly ron gastrobar, leaving fine-dining years behind , @ same time launching new trend. in fact, michelin netherlands talking ron blaauw effect. dishes priced @ 15 (desserts 9) , restaurant lauded dry-aged barbecue steaks. [$$$]', ('sophialaan 55 hs\namsterdam, north holland 1075 bp, netherlands', '+31 20 496 1943')) 13 choux ('relatively new on amsterdam dining scene  booked solid dinner every night  choux serves natural wines , light, fresh cuisine, latter touch of comfort. order three, four, or 7 courses monthly-changing menu chef merijn van berlo (including excellent vegetarian option). fail snag seat @ dinner, theres three- or four- course menu available @ lunchtime. [$$$]', ('de ruijterkade 128\namsterdam, north holland, netherlands', '+31 6 16512364')) 20 la perla ('if youre in mood pizza, la perla in jordaan place go. restaurant split in two, pizzeria on 1 side of street, , huge wood-fired oven on other. try classic margherita (with buffalo mozzarella) or order special porchetta di ariccia, made oven-roasted pork. [$$]', ('tweede tuindwarsstraat 14 & 53\namsterdam, north holland 1015 rz, netherlands', '+31 20 624 8828')) 6 slagerij de leeuw ('head butchers shop/deli if youre planning cook meal in rental apartment. de leeuw, gourmet butch shop in amsterdam, offers wide range of top-quality fresh meat , poultry, such wagyu , rubia gallega beef, iberico pork, , bresse chicken. gourmet picnic, theres great selection of charcuterie, cold meats, pats, , other ready-made delicacies. [$$]', ('utrechtsestraat 92\namsterdam, north holland 1017 vs, netherlands', '+31 20 623 0235')) 7 librije's zusje amsterdam ('literally young sibling (zusje means little sister) of jonnie boers three-star restaurant de librije in zwolle, librijes zusje located in stunning waldorf astoria hotel. executive chef , de librije alumnus sidney schutte has modern , cutting-edge style of cooking, shines through in dishes. tasting menu has hefty price tag, worth every cent. [$$$$]', ('herengracht 542-556\namsterdam, north holland 1017 cg, netherlands', '+31 20 718 4643')) 34 twenty third bar ('the dutch cocktail scene small growing. best option, if amazing views, twenty third bar, situated on 23rd floor of hotel okura. extensive cocktail list features classics priced @ 15 (champagne cocktails 19.50), , theres small bar snack menu. okuras notoriously expensive two-michelin-starred restaurant ciel bleu located on same floor. [$$]', ('ferdinand bolstraat 333\namsterdam, north holland, netherlands', '+31 20 678 7450')) 16 gs ('this funky place ideal spot american-style brunch  has grown increasingly popular here in recent years  , provides respite in desperate need of hangover bloody mary. gs serves full range of egg dishes; chicken waffle burger famous among locals. bloody mary menu offers no fewer 13 different versions. gs has 2 branches. consider booking seat online in advance.', ('goudsbloemstraat 91\namsterdam, north holland 1015 jk, netherlands', '+31 20 362 0030')) 8 guts , glory ('guts & glory  lively, stripped-down place off rembrandt square opened super-talented chefs guillaume de beer , freek van noortwijk , partner johanneke van iwaarden  1 of hottest places eat in amsterdam. signature single-ingredient menu called chapter, changes every 2 3 months. after chicken, fish, beef, pork, , vegetarian, de beer , van noortwijk embark on chapter six: italian. [$$-$$$]', ('utrechtsestraat 6\namsterdam, north holland, netherlands', '+31 20 362 0030')) 31 le garage ('this iconic restaurant founded restaurateur joop braakhekke in 1990 in former garage. famous being celebrity haunt, perhaps equally famous dramatic red , black decor hasnt changed since opening. le garage has heavily french influenced menu (steak tartare, canard  la presse, le flottante), theres room modern dishes (squid carbonara, tuna pizza). [$$$]', ('ruysdaelstraat 54-56\n1071 xe amsterdam, netherlands', '+31 20 679 7176')) 23 broodjeszaak t kuyltje ('leisurely lunches not part of everyday life in netherlands, dutch sandwich, preferably on go. best place taste of dutch-style sandwich t kuyltje. people queue pastrami sandwich, equally delicious tartaar speciaal (minced raw beef, onion, hardboiled egg) or halfom sandwich (half corned beef, half liver). [$]', ('gasthuismolensteeg 9\namsterdam, north holland 1016 am, netherlands', '+31 20 620 1045')) 35 bak restaurant ('bak pop-up turned brick-and-mortar restaurant located on banks of river ij in amsterdams re-developed westelijk havengebied area. in short: expect serious food , serious wine, served in laid-back setting. menu reflects chef benny blistos love seasonal , local ingredients, , on wine list can expect natural wines , quirky grape varieties. lunch, bak offers affordable three-course menu 27. [$$]', ('van diemenstraat 410\namsterdam, north holland 1013 cr, netherlands', '+31 20 737 2553')) 21 restaurant breda ('a more upscale restaurant game-changing chefs guillaume de beer , freek van noortwijk (compared other restaurant guts & glory, anyway), bredas opening greeted widespread critical acclaim. dishes modern creative flavor combinations, , can taste ambition of these young chefs. sit down dinner , order basic, extra, or full monty tasting menu, , enjoy fine wines selected sommelier johanneke van iwaarden. open daily lunch , dinner. [$$$]', ('singel 210\namsterdam, north holland, netherlands', '+31 20 622 5233')) 37 restaurant blauw ('restaurant blauw indonesian spot renowned rijsttafel, thing order. rijsttafel table-filling feast of small dishes, rice, , condiments, hybrid dutch-indonesian tradition originated during dutch colonial era. theres vegetarian rijsttafel option, , can order more traditional indonesian dishes la carte menu. arrive hungry! [$$]', ('amstelveenseweg 158-160\namsterdam, north holland 1075 xn, netherlands', '+31 20 675 5000')) 32 par hasard ('herring , cheese aside, people think of fries when thinking of amsterdam. belgian-style double-baked fries @ par hasard (meaning: accident) regarded many best fries in town. grab order traditional topping of mayonnaise, satay sauce, or zoervleis (a type of beef stew). [$]', ('ceintuurbaan 113-115\namsterdam, north holland 1072 ez, netherlands', '+31 20 471 4052')) 29 conservatorium brasserie & lounge ('with immense floor-to-ceiling windows , glass ceiling, hands-down impressive lobby-cum-all-day-dining-room in amsterdam  essential part of total experience @ cosmopolitan hotel. enjoy drinks , snacks in lounge area or go brasserie lunch or dinner. standout dishes include veal cheeks mac , cheese, lobster au gratin, , apple crumble. theres selection of sandwiches , steaks. [$$$]', ('van baerlestraat 27\namsterdam, north holland 1070 lp, netherlands', '+31 20 570 0000')) 1 merkelbach ("located in former 18th-century coach house, merkelbach's spectacular garden hands-down best outdoor dining experience in amsterdam. restaurant prides on following principles of slow food movement, expect seasonal menu local ingredients. during day can walk in coffee , apple pie, , theres compact lunch menu. [$$]", ('middenweg 72\namsterdam, north holland 1097 bs, netherlands', '+31 20 423 3930')) 28 rijks @ rijksmuseum ('rijks brings fresh approach museum dining (its housed in rijksmuseum of dutch art , history). on menu  designed chef joris bijdendijk (formerly of three-michelin-starred le jardin de sens , one-starred bridges) , team  find inventive small plates. featured dishes guest-chefs cooked @ rijks, andr chiang , tim raue. order spit-roasted celeriac. [$$$]', ('museumstraat 1\namsterdam, north holland 1071 xx, netherlands', '+31 20 674 7000')) 33 fat dog ('for hot dogs, no further fat dog, amsterdams first-ever hot dog joint, opened acclaimed chef/restaurateur ron blaauw in 2014. order all-pork frank sauerkraut, mustard, , onion marmalade (called gangs of new york) or go chicken gado gado hot dog satay sauce, cabbage, , serundeng (spiced coconut flakes). innovation doesnt stop there: lamb dog comes baba ganoush, , theres veggie dog. [$]', ('ruysdaelkade 251\namsterdam, north holland 1072 ax, netherlands', '+31 20 221 6249')) 5 patisserie kuyt ('follow locals , food obsessives near , far fabulous patisserie finest pies, cakes, chocolates, biscuits, , eclairs. kuyt has selection of delicate savory pastries, quiches, , biscuits. choice overwhelming, dont leave without appelschnitt, or better yet, enjoy of beautiful , delicious baked goods in tea room. [$]', ('utrechtsestraat 109\namsterdam, north holland 1017 vl, netherlands', '+31 20 623 4833')) 

hope want


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -