Questions tagged as 'python'

1
answer

problem with functions

Good morning colleagues could tell me what error my code has when executing it always what is in the "except ValueError" I have already tried doing it in other ways and it does not give me this is my code: #-*coding:utf-8-*- '''7. Construir u...
asked by 20.11.2018 / 17:39
1
answer

How can I read a txt file from a python file?

I need to go through a file and extract the values of the arrays to save them in some variables the login.txt file which I need to go through has this structure: # user=["dirServer","usuario","passwd","rutaServer","rutaDescarga","patron"]...
asked by 15.11.2018 / 09:10
1
answer

Problems with treeview Tkinter Python

I have problems so that I print the table data correctly and sorted, it prints only one tuple and it does not show the first record. what could be my mistake. Thanks for the help. import psycopg2 from psycopg2.extras import RealDictCursor from...
asked by 15.11.2018 / 16:10
4
answers

Search for several items in a chain

I have a big doubt in an exercise that I am not able to solve yet. I comment, I have a string, dna="ATGCGAGTTGATA" , then I must find the position of the letters G and C . For this, what I have been doing is: for base in dna...
asked by 10.11.2018 / 23:27
2
answers

Is there a simple way to convert a list of type str to one of type int?

This is what I try: example1: a=['1','2','3','4'] for m in range(len(a)): int(a[m]) print(a) But then I realized that for example in: example 2: a=['1','2','3','4'] b= [] int(a[0]) b = b + [a[0]] print(b) #Output b = ['1']...
asked by 13.11.2018 / 01:50
1
answer

how to solve two views of the same url (Home) - Django

How is it going? I write because I do not know how to solve the following question in Django (from my condition again in this): I have two apps that must be shown in the same template. That is, they share the url that is the home, and they ha...
asked by 04.11.2018 / 17:48
1
answer

Pager with format 1 2 3

Hello, I'm using the django paginator 1.8 (paginator) works fine, but I would like you to show me the number of my pages in this way I have 21 records that means I have 3 pages and the pager should show: < < 1 2 3 > > but it...
asked by 18.03.2016 / 17:40
2
answers

I apply setText to a Qlabel of PyQt4 in Python and it does not modify the text in the tag but it is superimposed on the change

When I run the code a MainWindow appears in which there are two radioButtons, if I press either of the two, a container widget will be added and displayed in the main window, in it there will be several objects of which I care about the present...
asked by 03.07.2016 / 17:36
1
answer

how can I create a file that takes the name date-time.log

import datetime fecha = str(datetime.datetime.now())+str('test.log') print (fecha)--> 2018-10-30 09:18:29.606405test.log Why does the python console execute me and take out the name I want and when executing it in the code, no? the line...
asked by 30.10.2018 / 14:02
1
answer

It does NOT work except for python

! / usr / local / bin / python3 Write an iterative function iterPower​ ​(base,​ ​exp) that calculates the exponential baseexp simply by using successive multiplication. For example, iterPower (base, exp) must calcul...
asked by 01.11.2018 / 19:49