Вопрос - можно ли вообще такое сделать?
Может ли программа сама узнавать и перемножать на нужный КФ по 1 формуле
может ли она работать офлайн
etree.tostring(value)
value.text
<?xml version = "1.0" encoding = "UTF-8"?>
<applications>
<application>
<journalNumber>1</journalNumber>
</application>
<application>
<journalNumber>2</journalNumber>
</application>
</applications>
from lxml import etree
etxml = etree.parse('test.xml')
root = etxml.getroot()
values = root.xpath("//*[local-name() = 'journalNumber']")
for value in values:
print('XML: ', etree.tostring(value, encoding='unicode'))
print('Text: ', value.text)
XML: <journalNumber>1</journalNumber>
Text: 1
XML: <journalNumber>2</journalNumber>
Text: 2
list_1 = [1, 2, 3]
list_2 = [4, 5, 6]
list_3 = [7, 8, 9]
lists = {
'list_1': list_1,
'list_2': list_2,
'list_3': list_3
}
for list_name, list_values in lists.items():
for value in list_values:
print(f"Value: {value} from {list_name}")
Value: 1 from list_1
Value: 2 from list_1
Value: 3 from list_1
Value: 4 from list_2
Value: 5 from list_2
Value: 6 from list_2
Value: 7 from list_3
Value: 8 from list_3
Value: 9 from list_3
//*[@class='account-widget__username']
//div[@class='account-widget']//div[@class='account-widget__username']
import openpyxl
wb = load_workbook(filename='xxxx.xlsx')
ws = wb.worksheets[0]
ws['A1'] = 1
ws.cell(row=2, column=2).value = 2
ws.cell(coordinate="C3").value = 3 # 'coordinate=' is optional here
chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications" : 2}
chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)
from selenium.common.exceptions import TimeoutException
...
except TimeoutException:
...
source venv/bin/activate
, находясь при этом в папке с проектомresult = '{} and {} likes this'.format(', '.join(names[:-1]), names[-1])
result = f'{", ".join(names[:-1])} and {names[-1]} likes this'
from itertools import groupby
source = [
{'code': 'AA01', 'group': 'U01', 'user': '1375', },
{'code': 'AA01', 'group': 'U01', 'user': '1575', },
{'code': 'AA03', 'group': 'U02', 'user': '1375', },
{'code': 'AA02', 'group': 'U02', 'user': '1345', },
{'code': 'AA02', 'group': 'U03', 'user': '1315', },
{'code': 'AA01', 'group': 'U04', 'user': '1615', },
]
result = {}
for key, group in groupby(source, lambda x: x['group']):
subgroup = {}
for item in group:
subgroup[item['code']] = item['user']
result[key] = subgroup
{
'U01': {'AA01': '1575'},
'U02': {'AA03': '1375',
'AA02': '1345'},
'U03': {'AA02': '1315'},
'U04': {'AA01': '1615'}
}
# -*- coding: utf-8 -*-
from collections import Counter
from collections import OrderedDict
fileName = "text.txt" # отсюда берем текст для анализа
outFileName = "result.txt" # сюда записываем результат
letters = 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ'
with open(fileName, encoding='utf-8') as f:
text = f.read().replace('\n', '')
text = ''.join([x.upper() for x in text if x.upper() in letters])
occurs = {key: value / len(text) for key, value in Counter(text).items()}
occurs_sorted = OrderedDict(reversed(sorted(occurs.items(), key=lambda x: x[1])))
with open(outFileName, "wt", encoding="utf8") as f:
f.write(f'{len(text)}\n')
for k, v in occurs_sorted.items():
f.write(f'{k}:{v:.3f}\n')