Questions tagged [python-3.x]
USE ONLY IF YOUR QUESTION IS VERSION-SPECIFIC. For questions about Python programming that are specific to version 3+ of the language. Use the more generic [python] tag on all Python questions. Use the [python-2.x] tags for Python 2 questions.
309,574
questions
0votes
0answers
4views
getting every attribute of all the elements with a specific class name using selenium/python
This is my code
WebDriverWait(browser, 30).until(EC.presence_of_all_elements_located((By.CLASS_NAME, "content-box")))
href = WebDriverWait(browser, 30).until(EC....
0votes
0answers
8views
Store Debit/Credit cards data(Benefits) offered
I'm looking for APIs which can help me get the data for the cards(Any kind of cards are fine) offered by particular banks in India. I have tried going through multiple site but I have found all the ...
0votes
0answers
5views
Selenium using python and configuration problem
I have installed Pycharm community edition and configured the interpreter successfully which includes selenium also. Wen I am trying to write selenium code like calling webdriver . It is not ...
-3votes
0answers
14views
How do i start another python script(pygame) and when the game window is open go back to the program but the game should still work
This code starts my game inside of my voice assistant:
elif Answer1.lower() == 'game5':
import snake
snake
How do I start the game window, let the game work but go ...
0votes
3answers
29views
How would you convert the following dictionary to a specific JSON structure?
I'm by far not a Python3 hero, but focussed on learning some new skills with it, thus any help would be appreciated. Working on a personal project that I want to throw on GitHub later on, I run into ...
-6votes
0answers
18views
Difference between spectral and pseudo-spectral method while writing python code [closed]
What are the differences between spectral and pseudo-spectral (method) in Python code?
Kindly, show good examples of codes where I can understand the basic differences between the above two methods.
0votes
0answers
18views
TypeError: 'dict' object is not callable in BeautifulSoup [closed]
I tried writing code that would get all the titles and links on Google search result, then print all those titles and links.
from bs4 import BeautifulSoup
import requests
import colorama
from colorama ...
0votes
0answers
13views
What is the exact Tiktok API endpoint to get list of video ids (aweme_ids) using user id (uid)?
TikTok API to fetch the list of video ids corresponding to a particular username
I have been getting the USER_ID using /aweme/v1/discover/search/?keyword=USERNAME&cursor=0&count=10&type=1&...
0votes
1answer
8views
Can anyone help me create a nested loop with an increment?
What I mean is a nested loop that will print out symbols. The number of symbols should be determined by incrementing the rows.
At the same time the column of symbols should run for a set number before ...
0votes
0answers
7views
Dash Plotly error TypeError: Object of type DataFrame is not JSON serializable
Hello I am working with Dash for making dashboard.
Below is my code.
I tried to fix the error but not able to fix, Can anyone look into this?
on chrome i am getting. Error loading layout
I am getting ...
0votes
0answers
10views
I want my code to wait unless either of two buttons is pressed
ui.py
import tkinter as tk
sc = 0
q_txt = 'Can you please verify the pythagorous theorem using similarities of triangle.'
class Window():
var = tk.IntVar()
def __init__(self):
self....
0votes
1answer
20views
How to fix this IndetationError in python?
from timeit import Timer
timer_obj1 = Timer('list_sum()'),
'from_main_import list_sum'
timer_obj2 = Timer('numpy_arr_sum()'),
'from_main_import numpy_arr_sum'
print('Pure ...
0votes
0answers
20views
how to convert nested dictionary into table using python for loop?
I have a nested dictionary which look like this:
m = {'match':{'football':{'cricket':'batball','player':'joe','match':36}}}
and I want to convert this dictionary into table using for loop without ...
0votes
0answers
10views
Ragged Nested Numpy Array to Tensor
I have ragged nested arrays of .npy file that I have processed. The error is that it my model failed to convert the NumPy array to a Tensor with the remark 'Unsupported object type list') I have try ...
-2votes
1answer
19views
Python newb "Fill in the empty function so that it returns the sum of all the divisors of a number, without including it."
Good Day I'm a Python newb and I'm having a hard time figuring out how'd the output ended up 55? Also what is this sum in return sum?
Are there any other methods also to make it less complicated?
def ...
0votes
0answers
7views
How to crate a Hybrid Work Model roster simulation
My office is currently manually creating Hybrid work model Rosters. Can we automate the process in Python/Pandas?
Rules for creating a roster is:
for 2 weeks (10 working days) people should be in ...
-1votes
0answers
12views
Please help: My PyInstaller exe is not opening
I have this program which I can use to update a program. The problem is when I convert the program to .exe from .py using pyinstaller(using --onefile and --noconsole commands too) it is not opening.
...
-1votes
0answers
17views
Difference in precision when using Decimal constructor [duplicate]
I am learning Python and read about Decimal. Then i noticed the difference in output of the following two statements:
>>> Decimal('0.1') + Decimal('0.10') + Decimal('0.10') - Decimal('0.30')
...
0votes
1answer
41views
Pandas get rows with subtracting rows as a index
I have a function in python that gets the two rows for a yfinance dataframe of tickers. I am doing a calculation, where I make a row that holds the value obtained from subtracting the value, then ...
0votes
0answers
15views
Getting RuntimeError in Python while submitting in UVa Online Judge
I tried to solve problem 101 on Online Judge but Online Judge is giving me a RuntimeError. However, it runs just fine on my computer.
This is my code:
total_blocks = int(input())
inp = ''
commands = []...
0votes
0answers
4views
In mask detection open cv code and then when i press esc the window open says not responding and also tuple is not callable error is shown
This is my code:
import cv2
from tensorflow.keras.models import load_model
from keras.preprocessing.image import load_img,img_to_array
import numpy as np
import PIL
model=load_model('saved_model.h5')
...
-4votes
1answer
21views
CREATE A FUNCTION TO SORT(ASC) AN ARRAY BY THE QUANTITY OF THE ALPHABET 'A' IN IT [closed]
CREATE A FUNCTION TO SORT(ASC) AN ARRAY BY THE QUANTITY OF THE ALPHABET 'A' IN IT
EXAMPLE : ['APPLE','BANANA','PLUM'] HAS 1,3,0 'A' IN IT RESPECTIVELY SO
THE SORTING WOULD BE ['PLUM','APPLE','BANANA']
0votes
0answers
8views
How to create two different table in same model?
I want to create two different table in one model, I had change the table name but my 2rd table insert data in the first table, can someone tell how to do?
import datetime
from peewee import ...
1vote
2answers
15views
the ways of using zip function to generate the cell location based on the row and column information
I created the following dataframe, and would like to identify the cells which are Null,
import pandas as pd
import numpy as np
data = [{'a': 1, 'b': 2, 'c':3},
{'a':10, 'b': np.NaN, 'c':"&...
0votes
0answers
34views
Calculating complexity of custom list append function
I have created "C Array" in Python and added implementation for append as below:
class Array:
def __init__(self, size):
array_data_type = ctypes.py_object * size
...
-3votes
0answers
17views
Need python script to find the secret [closed]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char **argv)
{// the struct is used to ensure ...
-1votes
0answers
7views
How do I get the delete button to work using Python3 in a flask framework?
I'm currently enrolled in a full stack development course, I cant figure out why my delete button doesn't work. Im learning javascript, I was able to create checkboxes for created list and was able to ...
0votes
2answers
35views
Return a new instance from a class method
I've implemented a date class, which calculates the next day's date and the previous day's date.
eg. if today is 3/26/2022 (MM/DD/YYYY) then my method nextday gives 3/27/2022.
However, instead of ...
0votes
0answers
11views
Jupyter Notebook Organization w/ Reusable Code
I'm using:
Python3.7
VS Code + Jupyter Notebook Extension
Both macOS & Windows, and I keep my files in a Dropbox folder
I want to organize my notebooks into directories so it's easier to ...
-4votes
0answers
16views
How to fix "TypeError: function() argument 'code' must be code, not str" in kali linux"? [closed]
I can't run theHarvester(which is emailharvesting tool) in kali linux . It throws error everytime .I don't know how to fix this .
I searched everywhere but could not find anything.
*OS -kali linux [ ...
-1votes
0answers
14views
How to broadcast a message to all listening devices with Python
I'm trying to make a program that includes a "find available devices" feature, sort of like Chromecast.
What I need to know is, how can I use Python sockets to send data to every device on ...
0votes
0answers
13views
How do I change the angle of a rectangle on the tkinter Canvas?
I am trying to draw a cartoon frog on Canvas, on Python 3.
This is my code for the leg:
RightLeg = c.create_rectangle(600, 600, 700, 400, outline= 'green', fill= 'green')
I get my frog body off ...
0votes
2answers
12views
How to write a python program to interact with the browser?
In my company intranet, any request to an external website X in Internet will be redirected to an internal page containing a button that I have to click on. Then the external website X in Internet ...
0votes
0answers
7views
Python 3.x - Multi mouse button activated auto clicker
I am having troubles with the python code i am trying to write. I am attempting to create an auto-clicker that when I hold down left click and one of the side buttons, left click gets triggered every ...
0votes
1answer
25views
How to skip the space in the txt file
I'm trying to count all the letters from a text but I want to exclude the counting of a letter next to a space
from collections import Counter
text = 'in the seas and let fowl multiply in the earth \...
0votes
0answers
13views
Re-Export function/class from another package
I have a few package's on my team. Some are smaller and used in other, larger packages. What is the best practice for importing a function/class from one package and then re-exporting it in another ...
0votes
1answer
12views
Pysimplegui everything transparent except 1 element
How to make only one Text element not transparent?
As transparent app I use sg.Window option alpha_channel=0.1, but
one text element I need to make better visible. It is possible with Pysimplegui? ...
0votes
1answer
18views
How to change float to date type in python? (ValueError: day is out of range for month)
I have the following column:
0 3012022.0
1 3012022.0
2 3012022.0
3 3012022.0
4 3012022.0
...
351 24032022.0
352 24032022.0
df.Data = df.Data.astype('...
-3votes
0answers
16views
Python Get Average of Multiple Nested Dictionaries [closed]
I have a list of dictionaries. Each dictionary by itself can have nested levels, but the keys will always be the same. I'm trying to find the best way to get the mean of these values.
Example List of ...
0votes
0answers
15views
What would be the 'best' (efficient) way to implement a function that needs to integrate a large array of numbers?
I'm working with a function that needs to integrate the values of an array of numbers following an integrand function. This is implemented already in my code, but my problem is that each time I call ...
1vote
3answers
37views
Formatting Multiple Columns by Name using .loc
My goal is to state a list of columns by name that I want to apply the formatting to.
The section that is commented out is ideally what I am after (which would mean removing the line of code directly ...
-1votes
1answer
12views
Getting the same HREF link instead of different HREF links with Selenium
This is the first time I'm making a website scraper and I'm relatively new to programming in general. So I'm trying to get the HREF links for all the subpages on this site:. But when I ran the code, ...
0votes
0answers
23views
Remove stopwords using multiprocessing python
Removing stopwords is a standard NLP task. If we have N texts, how can I use multi processing in Python to, given a common list stopwords remove stopwords in parallel from the N texts? Normally one ...
0votes
1answer
38views
Add item to existing list and be able to print list for each item in range in new line
Hi am new just started Computer Science at London Met we have programming in Python. In this code am trying to add items to already existing appended list list.append([student_name, student_age, ...
-1votes
0answers
13views
PyAutoGUI Error "TypeError: 'NoneType' object is not iterable" [duplicate]
I am making a "super simple" script in VS Code that should use PyAutoGUI to find this button: . The problem is when I try to run this code:
#import libraries
import pyautogui as pg
#sleep ...
0votes
0answers
9views
Using matplotlib and PyQt5
I'm writing code to update a matplotlib graph in real time while embedded into a PyQt5 application. Separately, the two pieces of code (for the graph and the embedding of a still graph. Putting the ...
0votes
0answers
11views
how can I customize error response from aws authorizer function?
I have written a lambda authorizer function that calls two custom authorization services to validate the input token. So, from lambda authorizer, I want to return different possible messages for the ...
-1votes
0answers
14views
Why is my collision with Pygame not working properly? [duplicate]
So I'm making a little archery game for school. To check collision between the arrow and the targets I use the pygame.sprite.spritecollide() function, and the sprites are masked. This is the arrow's ...
1vote
2answers
32views
Selenium Select to return a list?
In python we have:
select = Select(driver.find_element_by_id('fruits01'))
But what if I want to have a list of all select tags and not just the first one?
I tried:
select = Select(driver....
-2votes
0answers
19views
How do I make it so that when I type something it responds with something in specific (python) [closed]
Im not looking for something like
username = raw_input("Enter username:")
print("Username is: " + username)
But something so that the output is:
User:hi
Output:hey there
User:wow
...