Questions tagged as 'python'

1
answer

You can name a python module using the __import__

I have the following code __import__('some_module') And I was wondering if it was possible to do something like this: __import__('some_module') as some_name     
asked by 26.01.2018 / 13:27
3
answers

How to call, in Python, a function whose name is stored in a variable?

There are 99 different function definitions: def Fun_1(): ... def Fun_2(): ... def Fun_3(): ... ... ... def Fun_99(): ... The value of the variable x is randomly obtained between 1 and 99: x = aleat(0, 99) The variable NomeFu...
asked by 12.09.2017 / 00:54
1
answer

Bar chart made in Python was "weird". Any suggestions on how to improve it?

Friends, The following graphic was generated: Thecodeusedwasasfollows:#-*-coding:utf-8-*-importmatplotlib.pyplotaspltimportmatplotlib.datesasdatesfromdatetimeimportdatetime,timedeltax=[]y=[]withopen("dataset_semAtaques__10Abril2017_1min.c...
asked by 22.08.2017 / 16:54
1
answer

Save all CSV files in mysql

   Objective: To create a program in python that when picking the data of the file   CSV, save to MySql and generate a graph. What has been done so far: A program in python, where it reads the file and prints the data as a test in the termin...
asked by 03.05.2018 / 16:51
1
answer

print text without translinelation rule

I need to print text from a file on a single line without the line breaks. def imprime_texto(): with open("texto.txt") as arquivo: linhas = arquivo.read().split("\n") for linha in linhas: print(linha.strip(), end=" ") Entry: Pro...
asked by 17.04.2018 / 21:14
1
answer

Input read more than one line of the string

I'm having a problem, my code needs to read a string that contains more than one line, however, it reads the first and to, as if when the line is skipped, it interpreted as an "enter." > def depositlist(): deplist = str(input('''Entre com a lis...
asked by 15.12.2017 / 04:39
2
answers

How to call class method in another app?

I want to create a file called config.py and put some settings inside a dictionary for whenever you need to invoke these parameters. But how do I call this parameter in Python? For example, I'm going to create the class Config...
asked by 29.12.2017 / 17:02
2
answers

Problem with repetition structure while

I made this little code so that it asked for a user and a password. If the data were the same as those defined within the code, show a "success", if the user is different from what is placed in the code, ask the user again. I tried to use the...
asked by 18.06.2017 / 03:15
1
answer

How to know which libraries are being used in a python project?

I made an installation of an application made in Python, it basically works as follows, it installs the Python program and in the end the installation copies the folder with the libraries for the Python installation. Everything works perfectl...
asked by 02.10.2017 / 20:26
1
answer

Curl Equivalent in python

I was learning to use site APIs for a project, and at the beginning I was struggling and needed to ask. This was the example of using the API to test credentials on the site, I believe it's C ++: curl -u user:password https://myanimelist.ne...
asked by 15.02.2018 / 02:23