Questions tagged as 'python'

2
answers

Error getting relative path in python

I try to get the relative path to open a txt document using the following code: imports os filePath = os.path.relpath('../ProyectoLenguajeInterprete/Test') txt = open(filePath) print "Content for: %r:" % filePath print txt.read() But he t...
asked by 02.05.2017 / 23:59
1
answer

Show only the first image in template in Django

I have two models: the first Property model and the second model Property Image: Class Property(models.model): title = models.CharField() Class PropertyImage(models.model): property = modelos.Foreignkey(Property, related_name='images...
asked by 17.10.2016 / 00:26
2
answers

How to print a text string with pauses between each letter printed in python 3.4?

Suppose I have string="I still find the guy funny" I want the result to be I still find the guy funny but that after each letter a small pause is made I thought about the code for letra in cadena: print(letra, end="") time.sleep(0...
asked by 03.10.2016 / 16:48
2
answers

Copy a word right next to another

I'm starting with python and I'm trying to make a script that takes a txt file with a list of words vertically and copied the same word next to it this automatically, it would be something like that. dictionary.txt: casa123 per...
asked by 23.08.2016 / 15:03
2
answers

Two forms in a single view Django - CreateView

I am trying to create a single form for a user that has fields of both forms, both the user and the userprofile that you create to extend the model. models.py from django.db import models from django.forms import ModelF...
asked by 02.09.2016 / 16:30
2
answers

Parsear string ip class c python

Hi, I'm trying to separate each of the octets from any ip address but I can not get it. I have this, it does not work: j = 0 ip = "a.b.c.d" for i in ip: j = j + 1 if str(i)==".": l = ip[:j] print l     
asked by 30.08.2016 / 20:55
1
answer

Problem installing Mayavi 4.5 in Python 3

I can not install Mayavi 4.5 correctly on Python 3. I have a full installation of Anaconda (the 64-bit version) on Python 3.5 and I installed Mayavi via: conda install -c menpo mayavi=4.5.0. The moment I try to load the library, I get the...
asked by 04.09.2016 / 18:50
1
answer

Tkinter, continue using program while executing a while

Good afternoon, I do a program where two dates are taken by the user and then a comparison with a While, I would like to continue using the program while the While is running, is there any way? def callback(): var=OpenHour.get() var1=C...
asked by 16.11.2016 / 20:46
1
answer

How can you download a file with Python with multiple connections (for example: something like the IDM download manager)?

What I'm looking for is to accelerate the download of files this is what I have so far: ruta = os.getcwd() r = requests.get('https://video.xx.fbcdn.net/v/t42.90402/10000000_200409650451005_3436979597881638912_n.mp4?efg=eyJ2ZW5jb2RlX3Rh...
asked by 02.04.2017 / 13:18
1
answer

Legends in bokeh with latex

I would like to know if there is any way to write the legends in Bokeh with LateX format. I say this because it is quite frustrating to write f(x)=x^3-1 , it is very poor.     
asked by 08.05.2016 / 22:38