Questions tagged as 'python-2.7'

2
answers

Elements of B whose indices are the positions of occurrences of equal elements in A

If I have the lists: A = [12, 15, 10, 15, 12, 10, 10, 10, 15, 12, 12, 15, 15, 15] B = [0.2, 0.3, 1.1, 0.2, 0.2, 0.7, 0.4, 0.6, 0.1, 0.3, 0.7, 0.4, 0.5, 0.5] How can I group the values of B that are in the repeated element posi...
asked by 06.04.2016 / 16:58
1
answer

Remove duplicates from a list by keeping the order

I had the list: A = [12, 15, 10, 15, 12, 10, 10, 10, 15, 12, 12, 15, 15, 15] , when doing: ASemRepetidos=set(A) I get ([10, 12, 15]) , as seen, if in A my first element is 12, in set(A) becomes 10, or I...
asked by 08.04.2016 / 12:56
1
answer

Problem compiling python in pyqt libraries, with py2exe

I'm trying to compile with py2exe , but when I'll compile from the error. I will give an example of this error, with the programs Python 2.7 64 bits, pyqt4 for Python 2.7, and py2exe for Python 2.7. Follow the example: Crea...
asked by 03.02.2016 / 01:24
1
answer

list index out of range

Tsup=[] Te=0 dt=1 t=range(0,3600*2,dt) r=len(t) for i in range(0,r): Tsup.append(20) .... Tsup.append( (((Pj[i]+Ps-Pc[i]-Pr[i])*(dt))/((m_al*c_al[i])+(m_a*c_a[i])))+Tsup[i] ) if i==r: Te=(((Pj[i]+Ps-Pc[i]-Pr[i])*(dt))/((m_al*c_al...
asked by 18.02.2016 / 13:36
1
answer

auth_token Node.js Instagram

To make a script work I need auth_token of an instagram application, and that according to instructions I should (and am) doing so: https://instagram.com/oauth/authorize/?client_id=1627c123e3fc481791e0d6be16ff57a0&redirect_uri=http:...
asked by 06.09.2015 / 06:25
1
answer

How to remove a line from a text file

Hello. I am creating a program that opens, saves or deletes links. However, although I can remove the selected item from the list of links, I can not delete the line from the file that corresponds to the selected item. I researched SOEN and foun...
asked by 30.03.2015 / 01:58
1
answer

Python lib subprocess

Does anyone know why it opens the 2 terminals with the same command "ls -la"? import subprocess cmd = ["xterm"] cmd.extend(['-e','bash','-c', 'ls -la; exec $SHELL']) subprocess.Popen(cmd, stdout=subprocess.PIPE) cmd.extend(['-e','bash','-c...
asked by 22.01.2015 / 20:20
1
answer

Exec command does not work in python

Well, I am not able to execute external functions (with exec) that will change global lists so that it is used in my main function, follows code: m = [] n = [] def mp((a,b),p): c = [n[0] for n in p] d = [z.index for z in c if (a == z)]...
asked by 27.08.2014 / 07:13
1
answer

Automatic field filling

I'm developing a application with Django (1.6.2) and Python 2.7 for learning, the application performs searches, searches, and edits in the DB, in one of the registers that I realize I would like to apply an autocompletion function of other fi...
asked by 09.07.2014 / 19:04
1
answer

Creating Loop Objects

class linha (): def __init__ (self, texto): self.texto = texto def criador (): for i in range(5): a = raw_input ('escreva: ') global objetoi objetoi = linha (a) How do I get the criador function t...
asked by 04.05.2014 / 04:51