-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
homework 4 Fadeev #10
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
1. $ pip show pillow | ||
WARNING: Package(s) not found: pillow | ||
|
||
2. ��������� ��������� ������ pillow � ���������� ��������� | ||
rufadeeeg@RU01NBFADEEEG01 MINGW64 /d/Dropbox/GeekBrains/2074_GB_Python_1- (homework_4_Fadeev) | ||
$ pip install pillow | ||
Collecting pillow | ||
Using cached Pillow-9.0.1-cp310-cp310-win_amd64.whl (3.2 MB) | ||
Installing collected packages: pillow | ||
Successfully installed pillow-9.0.1 | ||
WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available. | ||
You should consider upgrading via the 'C:\Users\rufadeeeg.KROHNEGROUP\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command. | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 /d/Dropbox/GeekBrains/2074_GB_Python_1- (homework_4_Fadeev) | ||
$ pip show pillow | ||
Name: Pillow | ||
Version: 9.0.1 | ||
Summary: Python Imaging Library (Fork) | ||
Home-page: https://python-pillow.org | ||
Author: Alex Clark (PIL Fork Author) | ||
Author-email: [email protected] | ||
License: HPND | ||
Location: c:\users\rufadeeeg.krohnegroup\appdata\local\programs\python\python310\lib\site-packages | ||
Requires: | ||
Required-by: | ||
|
||
3. �������� � ���������� ������������ ��������� | ||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ���� | ||
$ mkdir task_4_1 | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ���� | ||
$ cd task_4_1 | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ python3 -m venv virt | ||
bash: python3: command not found | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ python -m venv virt | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ ls | ||
virt/ | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ virt/Scripts/activate.bat | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ pip freeze | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. просто посмотреть можно ещё через |
||
Pillow==9.0.1 | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ "virt/Scripts/activate.bat" | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ pip freeze | ||
Pillow==9.0.1 | ||
|
||
4. ��������� pillow ���������� ������ � ���������� ��������� | ||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ pip freeze | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ pip install pillow==9.0.0 | ||
Collecting pillow==9.0.0 | ||
Downloading Pillow-9.0.0-cp310-cp310-win_amd64.whl (3.2 MB) | ||
Installing collected packages: pillow | ||
Successfully installed pillow-9.0.0 | ||
WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available. | ||
You should consider upgrading via the 'C:\Users\rufadeeeg.KROHNEGROUP\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command. | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ pip show pillow | ||
Name: Pillow | ||
Version: 9.0.0 | ||
Summary: Python Imaging Library (Fork) | ||
Home-page: https://python-pillow.org | ||
Author: Alex Clark (PIL Fork Author) | ||
Author-email: [email protected] | ||
License: HPND | ||
Location: c:\users\rufadeeeg.krohnegroup\appdata\local\programs\python\python310\lib\site-packages | ||
Requires: | ||
Required-by: | ||
|
||
rufadeeeg@RU01NBFADEEEG01 MINGW64 ~/Onedrive - KROHNE GROUP/������� ����/task_4_1 | ||
$ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import requests | ||
|
||
def currency_rates(code: str) -> float: | ||
|
||
web_data = requests.api.get('http://www.cbr.ru/scripts/XML_daily.asp') | ||
# user_cur = code | ||
web_list = web_data.text.split('><') | ||
my_list = [] | ||
aux_list = [] | ||
val = '' | ||
currency = '' | ||
result = 0.0 | ||
|
||
|
||
for i in range (0, len(web_list), 1): | ||
if web_list[i].split(' ')[0] == 'Valute': | ||
aux_list = [] | ||
aux_str = '' | ||
aux_list.append(web_list[i + 2][9]) | ||
aux_list.append(web_list[i + 2][10]) | ||
aux_list.append(web_list[i + 2][11]) | ||
aux_list.append(' ') | ||
aux_list.append(web_list[i + 5][6]) | ||
aux_list.append(web_list[i + 5][7]) | ||
aux_list.append('.') | ||
aux_list.append(web_list[i + 5][9]) | ||
aux_list.append(web_list[i + 5][10]) | ||
aux_list.append(web_list[i + 5][11]) | ||
Comment on lines
+19
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. хорошо, что это работает, но выглядит крайне избыточным надо бы поискать более оптимальный путь |
||
val = aux_list[0] + aux_list[1] + aux_list[2] | ||
currency = aux_list[4] + aux_list[5] + aux_list[6] +aux_list[7] + aux_list[8] + aux_list[9] | ||
aux_list.clear() | ||
aux_list.append(val) | ||
aux_list.append(currency) | ||
my_list.append(aux_list) | ||
|
||
for i in range(0, len(my_list), 1): | ||
if my_list[i][0] == code: | ||
result = result + float(my_list[i][1]) | ||
|
||
return(result) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. пробел после There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. если кода нет в ЦБР, то нужно возвращать |
||
|
||
print(currency_rates('USD')) | ||
print(currency_rates("noname")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
следите за кодировками файла - стандартная, рекомендуемая
UTF-8