2018-05-21

posted May 21, 2018, 6:13 AM by Konstantinovich Samuel   [ updated May 21, 2018, 9:55 AM ]
More resources for web related python:



POKELAB!
Make a new folder for this lab:
~/public_html/06/

Sometimes you need to work with multiple data files. This lab is to get you used to the idea of comparing multiple data sets.

Here are 300 images, and 2 csvs. 

DO NOT DOWNLOAD THEM. (Since they are already on marge/homer/etc)
You will just link to them on my home directory. You may only link to them from the school servers since they are on the same network. 
e.g. 
data = open("/home/support/konstans/public_html/pokedata/data.csv","r").read()
images too:
print '<img src="http://marge.stuy.edu/~konstans/pokedata/001.png" >'

Step 1: Make sure you can print out a website that displays a pokemon image from that directory! 

-The csv file will only work on the school compute this way!
-You can always just run the website on marge to see results. (Marge is a school computer)
-If you need to test on your home computers and laptops, you will need to download the CSV file to test. You may also want to download a few images to test as well.

data.csv:
id identifier species_id height weight base_experience order is_default
1 bulbasaur 1 7 69 64 1 1
2 ivysaur 2 10 130 142 2 1
3 venusaur 3 20 1000 236 3 1
4 charmander 4 6 85 62 5 1
5 charmeleon 5 11 190 142 6 1

evolve.csv
id,evolves_from_species_id
1,NA
2,1
3,2
4,NA
5,4
6,5
7,NA

images are   <ID>.png  (where ID has leading 0's to always have 3 digits)
001.png
002.png
...
300.png


YOUR LAB PART 1:
Make an HTML table that looks like this 
(with all 300 pokemon and all the data shown in the header)

IDimagenameheightweight
001Bulbasaur769
002Venusaur10    130
 
+298 MORE ROWS...


Comments