import random
old_state = random.getstate()
print(random.random())
random.setstate(old_state)
print(random.random())
# You can also restore the state into your own instance of the PRNG, to avoid
# thread-safety issues from using the default, global instance.
prng = random.Random()
prng.setstate(old_state)
print(prng.random())
0.845561713648235
0.845561713648235
0.845561713648235
ET.ElementTree(data).write("xml.xml")
<yml_catalog><offer><name>имя abc</name></offer></yml_catalog>
ET.ElementTree(data).write("xml.xml", encoding='UTF-8')
<yml_catalog><offer><name>имя abc</name></offer></yml_catalog>
//*[@class='testCard']/a
def parse(self):
self.go_to_questsions_page()
slide_elems = self.driver.find_elements_by_class_name("testCard")
f = open("text.txt", "w")
f.write(str(slide_elems))
for el in slide_elems:
print(el.get_attribute('href'))
как его активировать при помощи request или каким либо другим способом
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()
elements = driver.find_elements_by_css_selector('.new-posts .post-item a')
page_urls = [element.get_attribute('href') for element in elements]
for url in page_urls:
driver.get(url)
import moviepy.editor as moviepy
clip = moviepy.VideoFileClip("myvideo.avi")
clip.write_videofile("myvideo.mp4")
from more_itertools import divide
for n in range(2, 7):
print(f'n: {n} - {[list(x) for x in divide(n=n, iterable=[1, 2, 2, 3, 4, 3])]}\n')
n: 2 - [[1, 2, 2], [3, 4, 3]]
n: 3 - [[1, 2], [2, 3], [4, 3]]
n: 4 - [[1, 2], [2, 3], [4], [3]]
n: 5 - [[1, 2], [2], [3], [4], [3]]
n: 6 - [[1], [2], [2], [3], [4], [3]]
Process finished with exit code 0
import math
print(math.__file__)
Вопрос 1 (Фото 1). От блока питания идет два кабеля CPU1-P4 и CPU2-P8. Куда и вставлять и нужны ли они вообще?
Вопрос 2 (Фото 3). Так же есть разъемы на самой материнской плате: ATX_12v_2x2 и ATX_12v_2x4. Для чего они нужны? Мне казалось туда нужно вставлять кабели CPU1-P4 и CPU2-P8?
pip install selenium-wire
from seleniumwire import webdriver
options = {
'proxy': {
'http': 'http://username:password@host:port',
'https': 'https://username:password@host:port',
'no_proxy': 'localhost,127.0.0.1,dev_server:8080'
}
}
driver = webdriver.Firefox(seleniumwire_options=options)