Posts by x8ss • 152 points
13 posts
-
0
votes2
answers93
viewsQ: How to make a function accept a Slice parameter of any kind?
I created this shuffle function, but I would like it to accept and return any kind of Slice func Shuffle(ptr *[]int, seed int64) []int { rand.Seed(seed) rand.Shuffle(len(*ptr), func(i, j int) {…
-
0
votes2
answers806
viewsQ: How to use cv2.imread() with an image type object instead of "image path"?
I wonder if there’s any way to do something like this: import cv2, pyautogui screenshot = pyautogui.screenshot() cv2.imread(screenshot, 0) Instead: import cv2, pyautogui screenshot =…
-
-3
votes2
answers214
viewsQ: How to create all possible combinations from a string?
I tried to use a = 'abcdefghijklmnopqrstuvwxyz' itertools.product(a, repeat=4) to create all possible words with 4 letters, but it seems to me that when the quantity is too large it doesn’t work…
-
0
votes1
answer552
viewsQ: What is the difference between request and request. Session()?
I would like to know the difference between request and request. Session() of the request module. What would be the ideal use of each?
-
1
votes1
answer200
viewsQ: How to create simple list from composite list?
What is wrong here? I would like the output to be [123, 456, 789]: a = [(1, 2, 3), (4, 5, 6), (7, 8, 9)] b = [] for num in a: x = '' for num2 in num: x.join(num2) b.append(x) print(b)…
-
0
votes2
answers105
viewsA: How to perform a function several times simultaneously?
I figured out a way using the threading module: import threading import time def a(): while True: print("oi") time.sleep(1) numeroDeProcessos = 3 if __name__ == "__main__": for i in…
-
-1
votes2
answers105
viewsQ: How to perform a function several times simultaneously?
What my code does: import time def oi(): while True: print("oi") time.sleep(1) oi() Output (in 2 seconds past): oi oi What I want you to do: import time import multiprocessing def oi(): while True:…
-
-3
votes1
answer486
viewsQ: How to speed up my python program?
I made a web scraping program, however the requests are very slow, I modified my program in a way that if I run it in several windows it works faster, only it becomes a mess. Is there any way to do…
-
-1
votes2
answers154
viewsA: Sorted returns white space inside the Array
Friend, you have a much easier solution! a = input() x = a.replace(' ', '') # <- Remove os espaços! print(sorted(x)) Dai vc tbm can transform to int again: x = int(x)…
-
5
votes2
answers6898
viewsQ: How to open html files directly from visual studio to my default browser?
I use visual studio code on Ubuntu, and would like to know if you have any way to open an html file with just one click for my default browser
visual-studio-codeasked x8ss 152 -
0
votes2
answers91
viewsA: When changing the value of a variable, all objects in the same class are changing
Dude, I was able to do 2 different results changing the name of one of the variables to rreecctt, also excludes the rect.center variable from her class, because she was basically a dead weight…
-
3
votes3
answers559
viewsQ: How to know the type of a variable in Kotlin?
What is the function to know the type of a variable? ex: var a = "teste" print(a.type()) output: String
-
3
votes2
answers94
viewsA: Problem when typing str in Python
# Checador de numeros numeros = [] # -> Todos os números validos vão entrar nessa lista! numero = 0 contagem = 0 while contagem != 5: try: numero = int(input(f"Digite um número: ({contagem +…