Questions tagged as 'python-3.x'

1
answer

Concatenate two dictionaries without repeating field

I have two dictionaries with the same keys, one key value in common and the other different values, as follows: Colombia = {'stats': [{'value': [{'wins': 3}, {'ties': 1}, {'defeats': 2}], 'team': 'Colombia'}], 'cup': 41} Brasil =...
asked by 17.05.2016 / 00:46
1
answer

How the function emit () works in python

I'm starting in python, today the teacher explained us about the function emit and I use the following example: from PyQt5.QtWidgets import QMainWindow,QApplication from PyQt5 import uic from PyQt5 import QtCore import threading class Princip...
asked by 11.12.2018 / 00:30
3
answers

Get a part of the text

I have the following text    /department-sales-palermo-page-3.html And I need to get everything that is after the 3 script (-) The first thing I thought was doing url = /departamento-venta-palermo-pagina-3.html url[-13:] and he r...
asked by 12.12.2018 / 18:14
2
answers

return True if at least one item in a list is 2 or 3

In a list of 2 integers I want True to return if it contains a 2 or a 3 with the following code: def has23(nums): for i in range(len(nums)): if nums[i] == 2 or nums[i] == 3: return True else: return False For example,...
asked by 01.10.2018 / 01:43
2
answers

How to limit decimals without rounding

I have the following code, which is responsible for limiting the number of decimals of the result a = 14567 n = "%.1f" % (a/1000)+"K") at the time of doing print() , I get as a result 14.6K, the problem is that I do not want me...
asked by 28.11.2018 / 20:06
2
answers

Problem counting correct answers

I am developing a program to ask me words. I try to collect the number of correct answers, but the counter gives me in all cases 0 or 1 . How can I solve it? Here the code: diccionario = {} numeropalabras = int(input("¿Cuan...
asked by 22.11.2016 / 14:33
1
answer

Publish project in Python 3.5 with heroku

Hi, I have a project made with Python 3.5 and Django 1.10 and I would like to publish it in HEROKU but I see that it only supports Python 2.7, does anyone know if heroku supports Python 3.5?     
asked by 18.09.2016 / 03:56
1
answer

Create temporary file in memory

I would like to know if there is a way to make a file saved in memory without having to write it to disk. for example: imagen = wx.Bitmap('imagen.png', wx.BITMAP_TYPE_ANY) Now I want to take the image data and save it in memory, wx.Bitmap h...
asked by 04.12.2018 / 14:42
1
answer

Character error in Python3

I have problems when executing the following code in Python: #!/usr/bin/python # -*- coding: iso-8859-15 -*- import os, sys sara1 = '░█▀▀▀█ ─█▀▀█ ░█▀▀█ ─█▀▀█' sara2 = ' ▀▀▀▄▄ ░█▄▄█ ░█▄▄▀ ░█▄▄█' sara3 = '░█▄▄▄█ ░█─░█ ░█─░█ ░█─░█' print (sara1)...
asked by 10.11.2018 / 20:09
1
answer

Align text of items in a QTableWidget

I am trying to center the texts of an item of QTableWidget for which I occupy the following: self.tabla.insertRow(self.tabla.rowCount()) self.tabla.setItem(self.tabla.rowCount()-1,0,QTableWidgetItem(_id).setTextAlignment(QtCore.Qt.Align...
asked by 07.08.2018 / 00:24