This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def triangle_area(height,width): | |
| return (height*width/2) | |
| print (triangle_area(5,3)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| from turtle import Turtle | |
| tina = Turtle() | |
| def draw_circle(name,r,color,x,y): | |
| name.penup() | |
| name.goto(x,y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import urllib.request | |
| import time | |
| from bs4 import BeautifulSoup | |
| url = 'http://makthavare.se/2018/09/19/kartlaggning-har-ar-riksdagsledamoterna-pa-twitter-2/' | |
| response = requests.get(url) | |
| soup = BeautifulSoup(response.text, "html.parser") | |
| soup.findAll('a') | |
| one_a_tag = soup.findAll('a')[36] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import urllib.request | |
| import time | |
| from bs4 import BeautifulSoup | |
| #url = 'https://www.alvin-portal.org/alvin/resultList.jsf?faces-redirect=true&searchType=PLACE&sortString=name_sort_asc&noOfRows=1000&af=%5B%5D&query=&aq=%5B%5B%7B"free_text"%3A"Turkiet"%7D%5D%5D&aqe=%5B%5D&dswid=-2660' | |
| urls =['https://www.alvin-portal.org/alvin/resultList.jsf?faces-redirect=true&includeViewParams=true&query=&searchType=PLACE&dswid=-2660&noOfRows=1000' | |
| ,'https://www.alvin-portal.org/alvin/resultList.jsf?dswid=-2660&p=1001&searchType=PLACE&sortString=name_sort_asc&noOfRows=1000&af=%5B%5D&query=&aq=%5B%5B%5D%5D&aqe=%5B%5D' | |
| ,'https://www.alvin-portal.org/alvin/resultList.jsf?dswid=-2660&p=2001&searchType=PLACE&sortString=name_sort_asc&noOfRows=1000&af=%5B%5D&query=&aq=%5B%5B%5D%5D&aqe=%5B%5D' | |
| ,'https://www.alvin-portal.org/alvin/resultList.jsf?dswid=-2660&p=3001&searchType=PLACE&sortString=name_sort_asc&noOfRows=1000&af=%5B%5D&query=&aq=%5B%5B%5D%5D&aqe=%5B%5D' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import urllib.request | |
| import time | |
| from bs4 import BeautifulSoup | |
| def cleanupstring(s): | |
| out_s = s | |
| while ' ' in out_s: | |
| out_s = out_s.strip().replace(' ', ' ') | |
| return out_s, len(s)-len(out_s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36", | |
| "environment": { | |
| "networkUserAgent": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse", | |
| "hostUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36", | |
| "benchmarkIndex": 1444 | |
| }, | |
| "lighthouseVersion": "5.6.0", | |
| "fetchTime": "2019-11-11T14:45:20.119Z", | |
| "requestedUrl": "https://libris.kb.se/katalogisering/search/libris?q=August%20Strindberg&_limit=20&%40type=%2a", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PREFIX dc: <http://purl.org/dc/elements/1.1/> | |
| SELECT ?objectInfo ?title ?creator | |
| WHERE { | |
| ?objectInfo dc:title ?title . | |
| ?objectInfo dc:creator ?creator . | |
| FILTER (regex(?creator, 'Royen') && regex(?creator, 'Adrianus')) | |
| } | |
| # see https://phabricator.wikimedia.org/T240290 | |
| # http://sparql.europeana.eu/?default-graph-uri=http%3A%2F%2Fdata.europeana.eu%2F&query=PREFIX+dc%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0D%0ASELECT+%3FobjectInfo+%3Ftitle+%3Fcreator%0D%0AWHERE+%7B%0D%0A+++++%3FobjectInfo+dc%3Atitle+%3Ftitle+.%0D%0A+++++%3FobjectInfo+dc%3Acreator+%3Fcreator+.%0D%0A+++++FILTER+%28regex%28%3Fcreator%2C+%27Royen%27%29+%26%26+regex%28%3Fcreator%2C+%27Adrianus%27%29%29%0D%0A%7D+%0D%0A%23+see+https%3A%2F%2Fphabricator.wikimedia.org%2FT240290&format=text%2Fhtml&timeout=0&debug=on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def check(Qnumber): | |
| checkURL = "https://www.wikidata.org/wiki/Special:EntityData/" + Qnumber + ".json" | |
| responseQikidata = requests.get(checkURL) | |
| if responseQikidata.status_code == 404: | |
| return False | |
| return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import requests | |
| urlbase = 'http://data.europeana.eu/' | |
| uribase = 'agent/base/' | |
| import sys | |
| print (sys.getdefaultencoding()) | |
| def checkWDobject(Qnumber,currUri): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import requests | |
| import time | |
| urlbase = 'http://data.europeana.eu/concept/base/' | |
| import sys | |
| print (sys.getdefaultencoding()) | |
| def check(Qnumber): |