from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument(f"user-data-dir={profile_path}")
driver = webdriver.Chrome(options=chrome_options)
text += "{}. {} {} - {} раз\n".format(i+1, vkGetFirstName(int(row[0])), vkGetLastName(int(row[0])), row[1])
r = int(input("Введіть кількість рядків: "))
mas = []
for i in range(r):
x = [int(j) for j in input().split()]
mas.append(x)
for i in mas:
if len(i) > 6:
print(i[0])
Введіть кількість рядків: 3
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
1
8
15
Process finished with exit code 0
from multiprocessing import Process
import time
print(1)
def func1():
print('test1')
time.sleep(10)
def func2():
print('test2')
time.sleep(5)
def test_multiprocessing():
p_func1 = Process(target=func1)
p_func2 = Process(target=func2)
p_func1.start()
p_func2.start()
p_func1.join()
p_func2.join()
print('done')
if __name__ == '__main__':
test_multiprocessing()
1
11
test2
test1
done
Process finished with exit code 0
if 'некоторые слова' in html:
print('Некоторые слова есть в HTML')
else:
print('Некоторых слов нет в HTML)
@daily rm -rf /tmp/.org.chromium.Chromium*
# Sleep before starting new loop
print ('Set pausa time')
for i in range(900, 0, -1):
sys.stdout.write(str(i) + ' ')
sys.stdout.flush()
time.sleep(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
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