python-3.x

Discord Bot doesn't join voice channel

不问归期 提交于 2021-02-11 16:27:45
问题 im struggling to making my bot get into a voice channel, i have already read alot of posts that are here and none of them has been able to solve my problem, im trying to get my bot to reproduce the voice of a yt video but it doesn't even join and i dont know what to do, here is the code: import os import discord import youtube_dl from random import random, choice, randint from dotenv import load_dotenv from discord.ext import commands load_dotenv() token = os.getenv("DISCORD_TOKEN") GUILD =

Why Tensorflow results are different in Python versions 3.5 and 3.7

雨燕双飞 提交于 2021-02-11 15:58:58
问题 Why Tensorflow results are different in Python versions 3.5 (SQL server, machine learning services) and 3.7 (local machine, anaconda)? I found out, it depends on 4 parameters values: dataset size number of epochs number of 1st layer (input) neurons number of 2nd layer (hidden) neurons Here is the example: identical results: dataset size - 50 000 number of epochs - 5/3/2 number of 1st layer (input) neurons - 300 **number of 2nd layer (hidden) neurons - 80% from 1st layer** different results:

Where to put large Python lists

冷暖自知 提交于 2021-02-11 15:57:38
问题 I'm writing a python program that uses a list of all of the words in an English dictionary, so we're talking a few megabytes. I would like a clean way of including the list as a constant without it getting in the way of the source code. I would put it in a JSON file or something, but I'm using PySimpleGUI, and I want to take advantage of its ability to turn the code into a Windows EXE file, and I doubt it could do that with an external text file. So, in order of preference I would like to do

Execute CMD commands using python

拥有回忆 提交于 2021-02-11 15:55:48
问题 what i'm trying to do is create a server and a client, the server being able to execute CMD commands. I managed to do the server-client communication but i have problems at controlling the command prompt using python. My current code is: import time import _thread import winpexpect class CommandPrompt(object): def __init__(self): self.cmd = winpexpect.winspawn('cmd.exe') def read(self): while True: if self.cmd.readline(): print(self.cmd.before) def send(self,usinput): self.cmd.sendline

How to determine why objects pass through each other in Colliderect

喜夏-厌秋 提交于 2021-02-11 15:53:33
问题 For some reason the Colliderect won't work and the rain passes through pavement. This is really annoying because all of those unused sprites create tons of lag. import pygame import random class Square(pygame.sprite.Sprite): def __init__(self, x, y, size1, size2, speedx, speedy, colour): super().__init__() self.image = pygame.Surface([size1, size2]) self.image.fill(colour) self.speedx = speedx self.speedy = speedy self.rect=self.image.get_rect() self.rect.x=x self.rect.y=y def update(self):

How to determine why objects pass through each other in Colliderect

不打扰是莪最后的温柔 提交于 2021-02-11 15:52:48
问题 For some reason the Colliderect won't work and the rain passes through pavement. This is really annoying because all of those unused sprites create tons of lag. import pygame import random class Square(pygame.sprite.Sprite): def __init__(self, x, y, size1, size2, speedx, speedy, colour): super().__init__() self.image = pygame.Surface([size1, size2]) self.image.fill(colour) self.speedx = speedx self.speedy = speedy self.rect=self.image.get_rect() self.rect.x=x self.rect.y=y def update(self):

Keras model summary incorrect

删除回忆录丶 提交于 2021-02-11 15:51:05
问题 I am doing data augmentation using data_gen=image.ImageDataGenerator(rotation_range=20,width_shift_range=0.2,height_shift_range=0.2, zoom_range=0.15,horizontal_flip=False) iter=data_gen.flow(X_train,Y_train,batch_size=64) data_gen.flow() needs a rank 4 data matrix, so the shape of X_train is (60000, 28, 28, 1) . We need to pass the same shape i.e (60000, 28, 28, 1) while defining the architecture of the model as follows; model=Sequential() model.add(Dense(units=64,activation='relu',kernel

Find a value from a dictionary in python by taking a key from user input [closed]

我是研究僧i 提交于 2021-02-11 15:51:01
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago . Improve this question I have a dictionary. How can I get the value by taking the key from user? d = {'a': '1', 'b': '2', 'c':'3'} If the user enters a I wanted to print value '1' . 回答1: This will do for you: print(p["a"]) This prints the number for "a" in the dictionary. For your

Find a value from a dictionary in python by taking a key from user input [closed]

大兔子大兔子 提交于 2021-02-11 15:50:53
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago . Improve this question I have a dictionary. How can I get the value by taking the key from user? d = {'a': '1', 'b': '2', 'c':'3'} If the user enters a I wanted to print value '1' . 回答1: This will do for you: print(p["a"]) This prints the number for "a" in the dictionary. For your

Keras model summary incorrect

﹥>﹥吖頭↗ 提交于 2021-02-11 15:48:44
问题 I am doing data augmentation using data_gen=image.ImageDataGenerator(rotation_range=20,width_shift_range=0.2,height_shift_range=0.2, zoom_range=0.15,horizontal_flip=False) iter=data_gen.flow(X_train,Y_train,batch_size=64) data_gen.flow() needs a rank 4 data matrix, so the shape of X_train is (60000, 28, 28, 1) . We need to pass the same shape i.e (60000, 28, 28, 1) while defining the architecture of the model as follows; model=Sequential() model.add(Dense(units=64,activation='relu',kernel