Sign In
Not register? Register Now!
You are here: HomeEssayIT & Computer Science
Pages:
3 pages/≈825 words
Sources:
2 Sources
Level:
Other
Subject:
IT & Computer Science
Type:
Essay
Language:
English (U.S.)
Document:
MS Word
Date:
Total cost:
$ 18.23
Topic:

Python Final UFO Reporting Database IT & Computer Science Essay (Essay Sample)

Instructions:

This was about Python Final UFO Reporting Database.There are 3 deliverables overall.
Part 1 UFO Sightings: Deliverable: Part 2 Latitude/Longitude: and Part 3 HeatMap.

source..
Content:

# -*- coding: utf-8 -*-
"""
Created on Sun May 10 15:57:53 2020
@author: Anonymous
"""
from bs4 import BeautifulSoup
import urllib.request
url = "http://www.nuforc.org/webreports.html"
urlpage = url
urlpageStates = "http://www.nuforc.org/webreports/ndxloc.html"
print(urlpage)
page = urllib.request.urlopen(urlpageStates)
# parse the html using beautiful soup and store in variable 'soup'
soup = BeautifulSoup(page, 'html.parser')
mydict = {}#store sightings by state and their tally
datatable = soup.find("table")
#print(datatable)
trs = datatable.find("tbody").find_all("tr")
for tr in trs:
a = tr.find("a") #find the links
link = a["href"]
location = a.text
page = urllib.request.urlopen("http://www.nuforc.org/webreports/"+str(link))
soupCity = BeautifulSoup(page,"html.parser")
#get the table rows in the second link
dt = soupCity.find("table")
trows = dt.find("tbody").find_all("tr")
for row in trows:
#get the city name
fonttag = row.find_all("td")[1].find("font")
city = fonttag.text
print("city tag: ",city)
#look for the location tag in dict
if location not in mydict:
mydict[location] = {city:1} #assign a count of 1
else:
mydict2 = mydict[location]
if city not in mydict2:
mydict2[city] = 1
else:
mydict[location][city] = mydict[location][city] +1 #add 1 to the city count
else:
print("done.....................\n",mydict)
def part_2():
url = "http://open.mapquestapi.com/geocoding/v1/address?key=KEY&location=Washington,DC"
page = urllib.request.urlopen(url)
soup = BeautifulSoup(page,"html.parser")
#based on database assumptions
trs = soup.find("table").find("tbody").find_all("tr")
mydict = {}
for tr in trs:
longitude = tr['long']

...
Get the Whole Paper!
Not exactly what you need?
Do you need a custom essay? Order right now:

Other Topics:

  • Admission Essay. University of Illinois at Urbana-Champaign.
    Description: Whenever I used a computer application or played a video game, I wondered how these programs were coded. My desire to seek answers led me to join my school's computer science club, where I attended lectures and participated in programming contests. ...
    1 page/≈275 words| No Sources | Other | IT & Computer Science | Essay |
  • Computer Science Business Strategy Blog 1 Assignment
    Description: Telecom solutions play an essential role in business in providing communication within the industry. The intended market requires telecom services for internet, business phone, and mobile phones for the desired employees. ...
    1 page/≈550 words| 2 Sources | Other | IT & Computer Science | Essay |
  • Technophobia Research Assignment: Invasion of Privacy
    Description: Technological fears among individuals in different organizational set ups. I am submitting it as a sample to showcase my skills in Harvard formatting style....
    3 pages/≈825 words| 4 Sources | Other | IT & Computer Science | Essay |
Need a Custom Essay Written?
First time 15% Discount!