python – ¿Como puedo convertir un mensaje string a código ascii y de este ultimo a código binario? En pycharm

He intentado y me quedo estancada aquí:
No entiendo como hacer que los códigos binarios de cada letrita estén en una misma linea.

class Solution:
“””String -> ASCII -> binary”””
def transform(self, stringToTransform):
oracion=stringToTransform
for letra in oracion:
asc= ord(letra)
binario= format(asc,”08b”)
print(binario)

    return oracion

stringToTransform = “hola como estas”
print(Solution().transform(stringToTransform))

python – PYGAME NÃO É RECONHECIDO NO PYCHARM

Boa noite, gente!

Eu estou com um problema que tá me irritado muito, pois nada resolve.Estou utilizando o pycharm e ele simplesmente não reconhece a biblio pygame. Eu já tentei de tudo, vários comandos no terminal (uso Linux) do próprio site Python, tutoriais brasileiros, gringos da internet, de fórum. Enfim, não sei mais onde caçar ajuda. O erro é “ModuleNotFoundError: No module named ‘pygame’
“. Quando eu utilizei alguns comandos no terminal, pareceu que tudo tava resolvido, mas é só executar o código que acontece isso. Alguém me ajuda porque tenho um jogo pra entregar sexta e não tenho muito tempo até lá kkkk

inserir a descrição da imagem aqui

pycharm – Búsqueda en una lista con diccionarios

Hola tengo esta lista:

({'Departamento': ' Tumbes', 'SIAGUA': 61.36}, {'Departamento': ' Pasco', 'SIAGUA': 66.93}, {'Departamento': ' Ica', 'SIAGUA': 68.12})

y este codigo de busqueda:

 def busquedad(depa):
            for p in lista:
                if ( p("Departamento") == depa ):
                    print("El porcentaje de:" , departamento('Departamento') , " es -> ", p("SIAGUA"))
                    return p

pero no corre cuando lo mando a imprimir ayudaa porfavor

mysql – Erro ao adicionar o mysqlclient no pycharm

Aparece esse erro quando tento adicionar o mysqlclient no pycharm

Collect Mysqlclient
Using the cached mysqlclient-1.4.6.tar.gz (85 kB)
No wheels could be created for mysqlclient because the & # 39; Wheel & # 39; is not installed.
Install collected packages: mysqlclient
Run the setup.py installation for mysqlclient: started
Run installation of setup.py for mysqlclient: ended with status & # 39; error & # 39;

ERROR: Command errored out with exit status 1:
 command: 'C:UsersNatasPycharmProjectsCRUDenvValidacaoPesquisaScriptspython.exe' -u -c 'import sys, setuptools, tokenize; sys.argv(0) = '"'"'C:\Users\Natas\AppData\Local\Temp\pycharm-packaging\mysqlclient\setup.py'"'"'; __file__='"'"'C:\Users\Natas\AppData\Local\Temp\pycharm-packaging\mysqlclient\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersNatasAppDataLocalTemppip-record-l25ij2luinstall-record.txt' --single-version-externally-managed --compile --install-headers 'C:UsersNatasPycharmProjectsCRUDenvValidacaoPesquisaincludesitepython3.8mysqlclient'
     cwd: C:UsersNatasAppDataLocalTemppycharm-packagingmysqlclient
Complete output (26 lines):
running install
running build
running build_py
creating build
creating buildlib.win32-3.8
creating buildlib.win32-3.8MySQLdb
copying MySQLdb__init__.py -> buildlib.win32-3.8MySQLdb
copying MySQLdb_exceptions.py -> buildlib.win32-3.8MySQLdb
copying MySQLdbcompat.py -> buildlib.win32-3.8MySQLdb
copying MySQLdbconnections.py -> buildlib.win32-3.8MySQLdb
copying MySQLdbconverters.py -> buildlib.win32-3.8MySQLdb
copying MySQLdbcursors.py -> buildlib.win32-3.8MySQLdb
copying MySQLdbrelease.py -> buildlib.win32-3.8MySQLdb
copying MySQLdbtimes.py -> buildlib.win32-3.8MySQLdb
creating buildlib.win32-3.8MySQLdbconstants
copying MySQLdbconstants__init__.py -> buildlib.win32-3.8MySQLdbconstants
copying MySQLdbconstantsCLIENT.py -> buildlib.win32-3.8MySQLdbconstants
copying MySQLdbconstantsCR.py -> buildlib.win32-3.8MySQLdbconstants
copying MySQLdbconstantsER.py -> buildlib.win32-3.8MySQLdbconstants
copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win32-3.8MySQLdbconstants
copying MySQLdbconstantsFLAG.py -> buildlib.win32-3.8MySQLdbconstants
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
building 'MySQLdb._mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------

ERROR: Command with exit status 1 failed: & # 39; C: Users Natas PycharmProjects CRUD envValidacaoPesquisa Scripts python.exe & # 39; -u -c & # 39; import sys, setuptools, tokenize; sys.argv (0) = & # 39; "& # 39;" & # 39; C: Users Natas AppData Local Temp pycharm-package mysqlclient setup.py & # 39; "& # 39;" & # 39 ;; file= & # 39; "& # 39;" & # 39; C: Users Natas AppData Local Temp pycharm-package mysqlclient setup.py & # 39; "& # 39; & # 39; & # 39 ;; f = getattr (tokenize, & # 39;" & # 39; "& # 39; open & # 39;" & # 39; "& # 39 ;, open) (file); code = f.read (). replace (& # 39; "& # 39;" & # 39; r n & # 39; "& # 39;", & # 39; "& # 39;" n & # 39; "& # 39; "& # 39;); f.close (); exec (compile (code, file, & # 39; "& # 39;" & # 39; exec & # 39; "& # 39;" & # 39;)) & # 39; install –record & # 39; C: Users Natas AppData Local Temp pip-record-l25ij2lu install-record.txt & # 39; – single version – externally managed –compile –install-headers & # 39; C: Users Natas PycharmProjects CRUD envValidacaoPesquisa include site python3.8 mysqlclient & # 39; Check the logs for complete command output.

pycharm – Using Mayavi mlab via VNC triggers an OpenGL error

In this time of social distancing, remote work becomes the new norm. I have some problems using Mayavi mlab in Python with PyCharm IDE from the MNE-Python environment. With Mayavi and VTK, I access the Conda environment from my local MacOS via a VNC session with an xvnc server from a local MacOS.

The error I get when opening a mlab window is:

ERROR: In ../Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 754 
vtkXOpenGLRenderWindow (0x556e13b32670): Unable to find a valid OpenGL 3.2 or later implementation. Please update your video card driver to the latest version. If you are using Mesa please make sure you have version 11.2 or later and make sure your driver in Mesa supports OpenGL 3.2 such as llvmpipe or openswr. If you are on windows and using Microsoft remote desktop note that it only supports OpenGL 3.2 with nvidia quadro cards. You can use other remoting software such as nomachine to avoid this issue.

I searched intensively online for possible solutions. It seems that using VirtualGL to intercept PyCharm to call OpenGL through VTK is a possible solution. Has anyone successfully resolved this issue of using Mayavi mlab through a VNC session? What are your solutions?

Thank you so much!

Javascript – is it better Atom, PyCharm or Visual Studio Code?

I'm starting to learn JavaScript, HTML and CSS. Is it better to use Atom, PyCharm or Visual Studio code? Which one do you recommend?

Windows 10 – BeautifulSoup4 on Pycharm – runtime error

A small program runs in Python:

from bs4 import BeautifulSoup
import requests

url = 'myurl'
resonse = requests.get(url)
soup = BeautifulSoup(resonse.content, 'lxml')
tag_info = soup.select('.col-md-12 > p:nth-child(3) > i:nth-child(1)')
print(tag_info(0).text)

Output:

Traceback (most recent call last):
  File "C:/Users/Kasper/.PyCharmEdu2019.2/config/scratches/scratch.py", line 1, in 
    from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'

Process finished with exit code 1

hmm – I think I have installed all the necessary plugins:

see the Powershell:

PS C:WINDOWSsystem32> pip install requests
Requirement already satisfied: requests in c:program filespython37libsite-packages (2.23.0)
Requirement already satisfied: certifi>=2017.4.17 in c:program filespython37libsite-packages (from requests) (2019.11.28)
Requirement already satisfied: chardet<4,>=3.0.2 in c:program filespython37libsite-packages (from requests) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in c:program filespython37libsite-packages (from requests) (2.9)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:program filespython37libsite-packages (from requests) (1.25.8)
PS C:WINDOWSsystem32> pip install pandas
Requirement already satisfied: pandas in c:program filespython37libsite-packages (1.0.3)
Requirement already satisfied: pytz>=2017.2 in c:program filespython37libsite-packages (from pandas) (2019.3)
Requirement already satisfied: numpy>=1.13.3 in c:program filespython37libsite-packages (from pandas) (1.18.2)
Requirement already satisfied: python-dateutil>=2.6.1 in c:program filespython37libsite-packages (from pandas) (2.8.1)
Requirement already satisfied: six>=1.5 in c:userskasperappdataroamingpythonpython37site-packages (from python-dateutil>=2.6.1->pandas) (1.12.0)
PS C:WINDOWSsystem32> pip install bs4
Requirement already satisfied: bs4 in c:program filespython37libsite-packages (0.0.1)
Requirement already satisfied: beautifulsoup4 in c:program filespython37libsite-packages (from bs4) (4.8.2)
Requirement already satisfied: soupsieve>=1.2 in c:program filespython37libsite-packages (from beautifulsoup4->bs4) (2.0)
PS C:WINDOWSsystem32>

Python – My Pycharm blames this bug. The process was completed with exit code -1073740791 (0xC0000409) and closes the window

# -*- coding: utf-8 -*-

from PyQt5 import QtCore, QtGui, QtWidgets

import sys


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(808, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        self.listWidget = QtWidgets.QListWidget(self.centralwidget)
        self.listWidget.setGeometry(QtCore.QRect(45, 61, 731, 401))
        self.listWidget.setObjectName("estoque")

        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(40, 10, 361, 51))

        font = QtGui.QFont()
        font.setFamily("HoloLens MDL2 Assets")
        font.setPointSize(20)

        self.label.setFont(font)
        self.label.setObjectName("label")
        self.botaoAdd = QtWidgets.QPushButton(self.centralwidget)
        self.botaoAdd.setGeometry(QtCore.QRect(40, 500, 251, 51))
        self.botaoAdd.setObjectName("pushButton")

        self.botaoRemove = QtWidgets.QPushButton(self.centralwidget)
        self.botaoRemove.setGeometry(QtCore.QRect(510, 500, 261, 51))
        self.botaoRemove.setObjectName("pushButton_2")

        self.botaoEdit = QtWidgets.QPushButton(self.centralwidget)
        self.botaoEdit.setGeometry(QtCore.QRect(280, 500, 300, 51))
        self.botaoEdit.setObjectName("pushButton_3")

        self.txtText = QtWidgets.QLineEdit(self.centralwidget)
        self.txtText.setGeometry(QtCore.QRect(290, 20, 241, 31))
        self.txtText.setObjectName("txtText")

        MainWindow.setCentralWidget(self.centralwidget)

        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 808, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)

        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        self.botaoAdd.clicked.connect(self.add_item)
        self.botaoRemove.clicked.connect(self.remove_item)
        self.botaoEdit.clicked.connect(self.edit_item)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label.setText(_translate("MainWindow", "Estoque atual"))
        self.botaoAdd.setText(_translate("MainWindow", "Adicionar ao estoque"))
        self.botaoRemove.setText(_translate("MainWindow", "Remover do estoque"))
        self.botaoEdit.setText(_translate("MainWindow", "Editar o estoque"))


    def add_item(self):
        self.listWidget.addItem(txtText)

    def remove_item(self):
        pass

    def edit_item(self):
        pass