Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit bd89be0

Browse files
committed
Add files via upload
1 parent 9d83c65 commit bd89be0

File tree

4 files changed

+75
-1
lines changed

4 files changed

+75
-1
lines changed

Week3/CursBnr.csv

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
,Data,AUD,BGN,CAD,CHF,CZK,DKK,EGP,EUR,GBP,100 HUF,100 JPY,MDL,NOK,PLN,RUB,SEK,TRY,USD,ZAR,BRL,CNY,INR,100 KRW,MXN,NZD,RSD,UAH,AED,HRK,THB,XAU,XDR
2+
0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
3+
1,12.04.2022,3.3799,2.5264,3.5922,4.8737,0.2022,0.6643,0.245,4.9412,5.9126,1.307,3.6197,0.2459,0.5151,1.0628,0.0544,0.4788,0.3096,4.5466,0.3122,0.9683,0.7138,0.0597,0.3693,0.229,3.1068,0.042,0.154,1.2378,0.6544,0.1352,285.3875,6.2243
4+
2,11.04.2022,3.3686,2.5262,3.5952,4.8445,0.2021,0.6643,0.2459,4.9409,5.9017,1.305,3.6078,0.2467,0.5181,1.0628,0.0558,0.4793,0.3069,4.523,0.3096,0.9631,0.7102,0.0595,0.3667,0.2267,3.0949,0.042,0.1538,1.2314,0.6546,0.1347,284.8316,6.2045
5+
3,08.04.2022,3.3908,2.5268,3.6095,4.86,0.2017,0.6645,0.2478,4.9419,5.9298,1.3091,3.6634,0.247,0.5177,1.0647,0.0574,0.4798,0.3081,4.5455,0.3084,0.9563,0.7144,0.0599,0.3705,0.2257,3.1149,0.042,0.1546,1.2375,0.6538,0.1352,282.3543,6.2314
6+
4,07.04.2022,3.3948,2.5271,3.6116,4.8617,0.2016,0.6645,0.2472,4.9426,5.9371,1.2967,3.6681,0.2468,0.5155,1.0622,0.0574,0.4795,0.3077,4.5378,0.3089,0.9621,0.7131,0.0597,0.3721,0.2256,3.1324,0.042,0.1543,1.2354,0.6547,0.1354,281.2279,6.2271
7+
5,06.04.2022,3.4354,2.5282,3.6261,4.8561,0.2023,0.6648,0.2474,4.9447,5.9339,1.3038,3.658,0.2456,0.5173,1.0631,0.0539,0.481,0.3073,4.5304,0.3095,0.9738,0.7121,0.0598,0.3723,0.2263,3.155,0.042,0.1541,1.2334,0.6552,0.135,281.0938,6.221
8+
6,05.04.2022,3.4366,2.5273,3.6139,4.8674,0.203,0.6646,0.247,4.9431,5.9149,1.3341,3.6666,0.2451,0.5168,1.0679,0.0537,0.4798,0.3059,4.5019,0.3097,0.9797,0.7075,0.0597,0.3712,0.2274,3.1538,0.042,0.1531,1.2257,0.6555,0.1347,279.4986,6.1984
9+
7,04.04.2022,3.3719,2.5276,3.5901,4.8389,0.2032,0.6646,0.2458,4.9437,5.885,1.3404,3.6597,0.2436,0.5136,1.0665,0.053,0.4767,0.305,4.4875,0.3068,0.9633,0.7052,0.0594,0.3694,0.2263,3.1082,0.042,0.1509,1.2218,0.6548,0.1339,278.1553,6.1847
10+
8,01.04.2022,3.3646,2.5285,3.5853,4.8439,0.2026,0.6648,0.2449,4.9454,5.8762,1.3455,3.6562,0.2431,0.5106,1.0648,0.0541,0.4782,0.3048,4.4763,0.3073,0.9445,0.7038,0.0589,0.3678,0.2256,3.1026,0.042,0.151,1.2187,0.6528,0.1337,278.4974,6.1762
11+
9,31.03.2022,3.3307,2.5291,3.5514,4.8196,0.2023,0.665,0.2433,4.9466,5.8374,1.337,3.6479,0.2426,0.5101,1.0627,0.0546,0.4783,0.3034,4.4508,0.3068,0.9329,0.7018,0.0588,0.367,0.224,3.0854,0.042,0.1507,1.2117,0.6531,0.1338,275.4789,6.1553
12+
10,30.03.2022,3.3306,2.5293,3.5543,4.7924,0.2024,0.6652,0.2432,4.947,5.833,1.3484,3.6414,0.2443,0.5127,1.0638,0.0526,0.4786,0.3026,4.4372,0.3067,0.9326,0.6986,0.0585,0.3669,0.2229,3.0931,0.042,0.1509,1.208,0.6535,0.1332,273.8176,6.1432

Week3/bs.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from bs4 import BeautifulSoup
2+
import requests
3+
import pandas as pd
4+
r = requests.get("https://bnr.ro/Cursul-de-schimb--7372-Mobile.aspx?pid=7372")
5+
link = BeautifulSoup(r.text, "html.parser")
6+
# print(link)
7+
header = []
8+
dataset = []
9+
title = link.findAll('div', attrs={'class': 'contentDiv'})
10+
for i in title:
11+
for tr_index in i.find_all('table'):
12+
for td_index in tr_index.find_all('tr'):
13+
td_list = []
14+
if td_index.find_all('th'):
15+
# print(td_index.find_all('th'))
16+
# for th_index in td_index.find_all('th'):
17+
# print(th_index.get_text())
18+
header = [th_index.get_text() for th_index in td_index.find_all('th')]
19+
for index, td_value in enumerate(td_index.find_all('td')):
20+
#print(index, td_value)
21+
if index == 0:
22+
td_list.append(td_value.get_text())
23+
else:
24+
td_list.append(float(td_value.get_text().replace(',', '.')))
25+
dataset.append(td_list)
26+
27+
print(header)
28+
df=pd.DataFrame(dataset,columns=header)
29+
df.to_csv("CursBnr.csv",header=header)

Week3/exceptions.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
variable = input("Enter a number:")
2-
2+
my_int = None
33
try:
44
is_integer = int(variable)
5+
print("no exceptions at meeting")
6+
if my_int is None:
7+
raise ValueError
58
except ValueError as e:
69
print("Error at value ", e)
710
except Exception as e:
811
# print(e.__doc__)
12+
913
print("You have a error at ", e)
1014
else:
1115
print("no exceptions at meeting")

Week3/namespaces.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# def my_function():
2+
# global msg
3+
# msg = "Hello"
4+
# print(msg)
5+
# return None
6+
#
7+
#
8+
# print(msg)
9+
# print(my_function())
10+
# print(dir(my_function()))
11+
# print(msg)
12+
13+
def my_function():
14+
def my_second_function():
15+
global msg
16+
msg = "Hello"
17+
print(print(locals()), "my second function")
18+
return None
19+
20+
my_second_function()
21+
# print(msg)
22+
msg = "Hello World!"
23+
print(f"principal function {msg}")
24+
return None
25+
26+
27+
my_function()
28+
# print(msg)
29+
print(globals())

0 commit comments

Comments
 (0)