This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
int main () { | |
int iSecret; | |
srand (time(NULL)); | |
iSecret = rand() % 5 + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
driver = webdriver.Chrome() | |
url = "https://www.btgpactualdigital.com/renda-variavel/venda-descoberta" | |
driver.get(url) | |
xpath = "/html/body/app-root/div/app-variable-sale/section/app-variable-assets-list/section/div/div[2]/div/ul/li[1]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elements = driver.find_elements_by_xpath(xpath[:-3]) | |
for element in elements: | |
print(element.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
from selenium.common.exceptions import TimeoutException | |
xpath = "/html/body/app-root/div/app-variable-sale/section/app-variable-assets-list/section/div/div[2]/div/ul/li[1]" | |
# Wait 20 seconds until the element is created | |
try: | |
WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, xpath))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df = pd.DataFrame(columns=["Ação", "Taxa %"]) | |
for i, element in enumerate(elements): | |
if len(element.text) < 11: # If any li is empty | |
continue | |
newElement = {} | |
newElement["Ação"] = element.text.split("\n")[0] | |
newElement["Taxa %"] = element.text.split("\n")[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 10 | |
y = 10 | |
print(x == y) | |
# True | |
print(x is y) | |
# True | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 10000 | |
y = 10000 | |
print(x == y) | |
# True | |
print(x is y) | |
# False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = [] | |
y = [] | |
print(x == y) | |
# True | |
print(x is y) | |
# False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 10000 | |
y = x | |
print(x == y) | |
# True | |
print(x is y) | |
# True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X = 10 | |
print(id(x)) | |
# 140002029632144 | |
x = 10000 | |
print(id(x)) | |
# 140001888536400 | |
x = [] | |
print(id(x)) | |
# 140001888523016 |
OlderNewer