Questions tagged as 'python'

1
answer

Import of variables from one file to another with FROM

The intention is to access from a file (called, say, " index.py ") to the variables defined in another (for example, " config.py " ). That is, import, to one file, the variables of the other. Ok, these are the contents of the f...
asked by 16.05.2018 / 12:45
2
answers

How to get the largest number from a list?

<listados=['31', '1', '3', '2', '5', '26', '3', '3', '1', '14', '2', '1', '21', '423', '2', '0', '0', '0', '2', '0', '0', '0', '0', '0', '0', '0', '3', '9'] print(max(listados))> He throws me: 9 it should be 423 The content of the (lis...
asked by 04.10.2018 / 06:31
2
answers

Search and print python file path

Dear users of the StackOverflow community ... I'm looking for a function in Python that allows me to find the path of a file. for example I know that I have a program called pycharm64.exe, or simply pycharm but I do not know the route ... I l...
asked by 07.02.2018 / 16:05
2
answers

Delete files with Python

I'm trying to make a bash adaptation (the Linux terminal) in Windows, for this I'm using Python. #-*- coding: utf-8 -*- import subprocess import os if __name__ == '__main__': wt = True while wt: cmd = str(raw_input("{}>".for...
asked by 26.03.2018 / 23:12
2
answers

How can I send a file through a socket?

I'm doing a little chat with sockets in python, I'm trying to make it possible to send files through the chat, I thought about this to send the file: file = open("file.txt", "rb") content = file.readlines(1024) sock.send(content) file.close()...
asked by 10.08.2018 / 00:33
2
answers

Run two programs at the same time

Let's imagine that I have two scripts written in a python. The first is called programa_1.py and the second programa_2.py . To be executed, and because it opens some particular files, the programa_1.py needs to run in a...
asked by 28.11.2017 / 17:00
1
answer

open winword.exe from python with the OS module

Good evening I would like to know how I can execute an MS-DOS command from python. I need to open WINWORD.EXE and this is the code I use import os r = os.system("C:/Program Files (x86)/Microsoft Office/root/Office16/") T = r + os.system("/W...
asked by 18.08.2018 / 02:21
1
answer

Graph with Python, Pandas

I have to graph from a csv file similar to this: Cedula,Genero,Placa,Tipo,Multa,Fecha 0931921407,Femenino,GYS-9575,Automovil,Grave,2016-06-13 0910703362,Masculino,GSF-7654,Automovil,Leve,2016-02-18 0931921408,Femenino,GOI-3298,Automovil,Muy gr...
asked by 23.08.2016 / 00:45
4
answers

Program to count the vowels of a chain

   "Perform a call_count_name () function that receives as an argument any string and returns the number of vowels present in the string." def contar_vocales(x): voc=0 for i in len(cad): if cad[i]=='a' or cad[i]=='e'or cad[i]=...
asked by 04.11.2017 / 19:53
1
answer

how to get the largest item in each row with numpy?

I try to get a list of the indexes of the largest elements in each row a = np.arange(16).reshape((4, 4)) print(a) print(np.amax(a, axis=1)) print(np.where(a == np.amax(a, axis=1))) this is the result: I get the largest matrix wher...
asked by 20.11.2017 / 04:33