Questions tagged as 'python-3.x'

2
answers

Count vowels and know how many there are

Good! I want to create a function that would allow me to say if a word or phrase has vowels, and if so, how many vowels it has, but I have 2 problems in my code that I do not understand: def conta_vogais(str): vogais = ['a','e','i','o','u'...
asked by 19.11.2016 / 17:02
0
answers

How to save the output result of a Python script to a txt file?

Script showing saved wifi passwords: import subprocess data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8', errors="backslashreplace").split('\n') profiles = [i.split(":") [1] [1:-1] for i in data if "Todos os...
asked by 05.12.2018 / 01:18
1
answer

How to write a tabular file in an instance of the Azure Data Lake Store with the Python API?

Suppose I have an instance of the Data Lake Store in my Azure subscription and I'd like to create a Python script to write a tabular file with a separator (of type CSV or similar) in that instance. Without considering the Spark API, how can I...
asked by 04.12.2018 / 22:38
1
answer

Error in application deploy Flask

I'm trying to deploy a flask application the same way I do when I'm using python2.7, but in this case I'm using python3 and an error is returned in wsgi. Below is the first line of the apache2 traceback. [Thu Dec 06 23:01:04.823744 2018] [wsgi...
asked by 07.12.2018 / 00:17
1
answer

Recursive function that returns the sum of the divisors of a number

As an exercise I had to create a recursive function that returns the sum of the divisors of a number. I made the following code, but it is giving maximum recursion error: def somadiv(n, i = 1, s= 0): if i <= n: return somadiv(s...
asked by 09.12.2018 / 23:46
0
answers

IndexError: index 1 is out of bounds for axis 0 with size 1

if ind == 0: for j in range (c_source-1,f_source): place.iloc[j,0]=place.iloc[j,0]+1 legenda = pd.DataFrame([lado_source]) place = pd.concat((legenda, place), join='outer') if ind == 1:...
asked by 29.11.2018 / 18:33
1
answer

Python 3: Tkinter - Background image does not exist, "pyimage1" does not exist

My code for displaying a background image: from tkinter import * def entrar(): #Janela Principal janela = Tk() janela.title("Salvadados") janela.geometry('400x600') #fotofundo back = Label(janela)...
asked by 28.11.2018 / 14:01
0
answers

Q: SQL login verification ALCHEMY Pending

I am creating a login to give access to the tool that I am beginning to create, the database is SQL Server The project structure is this: ├── Project │ ├── Controllers │ │ ├── __init__.py │ │ └── Mapping_Login │ │ ├── __in...
asked by 30.11.2018 / 10:31
1
answer

How to check the latest file in a folder with Python?

Assuming you have a folder with several TXT files with different names and need to know the latest file, how do I do this using Python?     
asked by 20.04.2018 / 14:13
0
answers

Mockar timedelta within a method

How do I mock the return of the timedelta method being used within a method of a class? I tried it as follows; with patch.object(datetime, 'timedelta') as mock_time: mock_time.return_value = (0, 1) # 1 second # timedelta(seconds...
asked by 23.11.2018 / 12:26