# #Internet connection
# import urllib.request as request

# src = "https://www.ntu.edu.tw/"

# # with request.urlopen(src) as response: # response is an object
# #     data = response.read() # get the web raw coding (eg HTML, CSS, JS)

# with request.urlopen(src) as response: # response is an object
#     data = response.read().decode("utf-8") # get the web raw coding (eg HTML, CSS, JS)
#     # .decode("utf-8") -->decode with UTF-8 encoding

# print(data)


#Internet connection
import urllib.request as request
import json #Json module

src = "https://data.taipei/api/v1/dataset/296acfa2-5d93-4706-ad58-e83cc951863c?scope=resourceAquire"
#src = "https://www.ntu.edu.tw/"

with request.urlopen(src) as response: # response is an object
   data = json.load(response) # use json module to read json data format

# Analyse data
clist = data["result"]["results"]
#print(clist)
with open("data.txt", "w", encoding="utf-8") as file:
    for company in clist:
        file.write(company["公司名稱"] + "\n")
        # print(company["公司名稱"])

#print(data)




# #Internet connection
# import urllib.request as request

# src = "https://www.ntu.edu.tw/"

# # with request.urlopen(src) as response: # response is an object
# #     data = response.read() # get the web raw coding (eg HTML, CSS, JS)

# with request.urlopen(src) as response: # response is an object
#     data = response.read().decode("utf-8") # get the web raw coding (eg HTML, CSS, JS)
#     # .decode("utf-8") -->decode with UTF-8 encoding

# print(data)


#Internet connection
import urllib.request as request
import json #Json module

src = "https://data.taipei/api/v1/dataset/296acfa2-5d93-4706-ad58-e83cc951863c?scope=resourceAquire"
#src = "https://www.ntu.edu.tw/"

with request.urlopen(src) as response: # response is an object
   data = json.load(response) # use json module to read json data format

# Analyse data
clist = data["result"]["results"]
#print(clist)
with open("data.txt", "w", encoding="utf-8") as file:
    for company in clist:
        file.write(company["公司名稱"] + "\n")
        # print(company["公司名稱"])

#print(data)




# #Internet connection # import urllib.request as request # src = "https://www.ntu.edu.tw/" # # with request.urlopen(src) as response: # response is an object # #     data = response.read() # get the web raw coding (eg HTML, CSS, JS) # with request.urlopen(src) as response: # response is an object #     data = response.read().decode("utf-8") # get the web raw coding (eg HTML, CSS, JS) #     # .decode("utf-8") -->decode with UTF-8 encoding # print(data) #Internet connection #Json module #src = "https://www.ntu.edu.tw/" # response is an object # use json module to read json data format # Analyse data #print(clist) # print(company["公司名稱"]) #print(data)