Questions tagged as 'python'

2
answers

How to use spaces instead of tabs in vim?

I program in python with VIM 8, and I have this doubt, I read that in PEP8 it is recommended that the indentations for python must be of 4 SPACES, in my .vimrc I have this configured by a recommendation of a Youtube video: set shiftwidth=4 set...
asked by 21.08.2018 / 02:29
1
answer

how can I add a time stamp to a file

from datetime import datetime fecha=datetime.now() how can I concatenate the date value to the name of a file archivo=fecha+.log so that I stay with this format 2018-10-29-12:31:31.log     
asked by 29.10.2018 / 09:25
1
answer

I do not know how I can get out of the if after the continue, since an infinite cycle is done

print ("Ingrese hasta que numero multiplo de 5 quiere sumar") x= int(input()) y=5 num=x%y while x>0: if num==0: print("Numero correcto") break if num!=0: print("Numero incorrecto, ingrese nuevamente") x=...
asked by 25.05.2018 / 07:14
1
answer

Replace values from a list in an array in Python

My problem is this, I want to replace a list of questions in the first row of a square null matrix leaving the first zero, that is, if the matrix is m rows by n columns, I would like to insert the list of questions to from the value [m, n] = [0,...
asked by 19.05.2018 / 06:15
2
answers

Select and format a Text from a Tkinter Text

Inside a Tkinter Text widget, in Python, I'm uploading a document. After analyzing the content and locating certain words of it, I must select them to give them a certain format, specifically, give them a background color and put them in bold....
asked by 21.05.2018 / 07:44
1
answer

Filter a DataFrame using a list

If I have the following dataframe a,b,c 0 2,3,8 1 5,6,5 2 7,8,7 I would like to filter the rows, but using a previously created list. Use something like this: num=[2,5] df=df[df['a'] in num] I would like to obtain the following resul...
asked by 24.04.2018 / 15:35
1
answer

How to delete characters in python console? [closed]

Something like in java that I think is with a \b but in python     
asked by 30.10.2016 / 19:24
1
answer

Edit Dataframe pandas .groupby

I have the following code: import dataiku from dataiku import pandasutils as pdu import pandas as pd mydataset = dataiku.Dataset("PRD_edited_rejoined") mydataset_df = mydataset.get_dataframe()' mydataset_df[u"Válido"] = (mydataset_df.groupby([...
asked by 24.04.2018 / 16:34
1
answer

Exception AttributeError: "'NoneType' object has no attribute 'dump'"

I find myself practicing with Python , doing a little POO , a class here, another over there ... :) ... and, also, with handling of files and pickle . I expose the code block of a file called "manager.py": # encoding: utf-8 from io impo...
asked by 23.04.2018 / 00:46
1
answer

Compatibility of Python and Mac OS

I have installed version 2.7 of python on a Macbook Pro mid 2012, and it looks something like this: WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. Visit http://www.python.org/download/mac/tcltk/ for current information. The...
asked by 31.10.2016 / 23:00