Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 3: Parsing and Manipulating XML Data An online plant distributor has recently experienced a shortage in its supply of Anemone plants such that the
Python 3:
Parsing and Manipulating XML Data An online plant distributor has recently experienced a shortage in its supply of Anemone plants such that the price has increased by 20%. Their plant catalog is maintained in an XML file and they need a Python utility to find the plant by name, read the current price, change it by the specified percentage, and update the file. Writing this utility is your assignment. Using Pythons ElementTree XML API, write a Python program to perform the following tasks below. Note that your programs execution syntax must be as follows: python xmlparse.py plant_catalog.xml plantName percentChange 1. Using ElementTree, read in this assignments XML file plant_catalog.xml specified by a command line parameter as shown above. 2. Find the plant by the name passed in as an argument on the command line (plantName above). 3. Once found, read the current price and adjust it by the command line argument percentChange. Note: that this value could be anything in the range of -90 < percentChange < 100. For example, if you run your script as follows: python plant_catalog.xml "Greek Valerian" -20 with the original XML containing:The resulting file should contain: Greek Valerian Polemonium caeruleum Annual Shade 4.36 071499 XML Code to work with: Greek Valerian Polemonium caeruleum Annual Shade 3.4880000000000004 071499
Bloodroot Sanguinaria canadensis 4 Mostly Shady 2.44 031599 Columbine Aquilegia canadensis 3 Mostly Shady 9.37 030699 Marsh Marigold Caltha palustris 4 Mostly Sunny 6.81 051799 Cowslip Caltha palustris 4 Mostly Shady 9.90 030699 Dutchman's-Breeches Dicentra cucullaria 3 Mostly Shady 6.44 012099 Ginger, Wild Asarum canadense 3 Mostly Shady 9.03 041899 Hepatica Hepatica americana 4 Mostly Shady 4.45 012699 Liverleaf Hepatica americana 4 Mostly Shady 3.99 010299 Jack-In-The-Pulpit Arisaema triphyllum 4 Mostly Shady 3.23 020199 Mayapple Podophyllum peltatum 3 Mostly Shady 2.98 060599 Phlox, Woodland Phlox divaricata 3 Sun or Shade 2.80 012299 Phlox, Blue Phlox divaricata 3 Sun or Shade 5.59 021699 Spring-Beauty Claytonia Virginica 7 Mostly Shady 6.59 020199 Trillium Trillium grandiflorum 5 Sun or Shade 3.90 042999 Wake Robin Trillium grandiflorum 5 Sun or Shade 3.20 022199 Violet, Dog-Tooth Erythronium americanum 4 Shade 9.04 020199 Trout Lily Erythronium americanum 4 Shade 6.94 032499 Adder's-Tongue Erythronium americanum 4 Shade 9.58 041399 Anemone Anemone blanda 6 Mostly Shady 8.86 122698 Grecian Windflower Anemone blanda 6 Mostly Shady 9.16 071099 Bee Balm Monarda didyma 4 Shade 4.59 050399 Bergamot Monarda didyma 4 Shade 7.16 042799 Black-Eyed Susan Rudbeckia hirta Annual Sunny 9.80 061899 Buttercup Ranunculus 4 Shade 2.57 061099 Crowfoot Ranunculus 4 Shade 9.34 040399 Butterfly Weed Asclepias tuberosa Annual Sunny 2.78 063099 Cinquefoil Potentilla Annual Shade 7.06 052599 Primrose Oenothera 3 - 5 Sunny 6.56 013099 Gentian Gentiana 4 Sun or Shade 7.81 051899 Blue Gentian Gentiana 4 Sun or Shade 8.56 050299 Jacob's Ladder Polemonium caeruleum Annual Shade 9.26 022199 Greek Valerian Polemonium caeruleum Annual Shade 4.36 071499 California Poppy Eschscholzia californica Annual Sun 7.89 032799 Shooting Star Dodecatheon Annual Mostly Shady 8.60 051399 Snakeroot Cimicifuga Annual Shade 5.63 071199 Cardinal Flower Lobelia cardinalis 2 Shade 3.02 022299
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started