Python 2.7 Question The dictionary should be created by reading the file link ad
ID: 666133 • Letter: P
Question
Python 2.7 Question
The dictionary should be created by reading the file link added. How can I add this data in codes below.
https://drive.google.com/folderview?id=0Bz_aB61VIRZAfnNoamZmZVdVR19TNmdmVDBwbk5aN1JsNkQyNTVRLUgwVVB2elVIUHBfcFE&usp=sharing
# Dictionary that contains tag and url
dict_mint = {}
# Insert into dict_mint
def insert_dict_mint(tag,url):
if tag in dict_mint:
dict_mint[tag].append(url);
else:
dict_mint[tag] = [url]
# Dictionary that contains URL as key and another Dictionary as value
dict_url = {}
def insert_dict_url(url,tag):
if url in dict_url:
l = dict_mint[tag]
count = 0;
for urls in l:
if (url == urls):
count += 1;
value = dict_url[url]
value[tag] = count
else:
l = dict_mint[tag]
count = 0;
for urls in l:
if (url == urls):
count += 1;
dict_temp = {}
dict_temp[tag] = count
dict[url] = dict_temp
Explanation / Answer
Below are the code in python to read file data from url
import urllib
txt = urllib.urlopen(target_https://drive.google.com/folderview?id=0Bz_aB61VIRZAfnNoamZmZVdVR19TNmdmVDBwbk5aN1JsNkQyNTVRLUgwVVB2elVIUHBfcFE&usp=sharing).read()
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.