Questions tagged as 'python-3.x'

1
answer

** optional kwargs with default

It is common to find several apis that make use of KeyWordArgument of python. My question is how to use this refuse for object attributes. Sometimes when I use an API and I pass a parameter named param=True and the class I'm instan...
asked by 19.10.2016 / 22:45
1
answer

TypeError: start () missing 1 required positional argument: 'self' when trying to use the chronometer module

I installed the chronometer module 1.0 for python 3.4: chronometer module I tried to use the start () attribute of the Chronometer method, but it gives an error: it requires a 'self' argument >>>from chronometer import Chronomete...
asked by 29.06.2016 / 21:15
2
answers

how to override the save method of models

I'm trying to override the save method of models so that when a new workbook is created it will be saved and exported immediately to a .json file, this would be a form of automatic backup, but when you register a new workbook it exports all the...
asked by 21.04.2016 / 00:14
2
answers

Python 3.5 + Django + PostgreSQL on Windows

I'm currently starting a web system project using Python 3.5 and the Django 1.9.1 framework, with the intention of integrating them with a database PostgreSQL 9.5 , all installed on a machine running Windows 10 x64 OS. The installation of Py...
asked by 02.03.2016 / 23:34
1
answer

Stop generator

What would be the best way to stop a generator? Example: >>> def get_fruits(): fruits = ['Mamão', 'Abacate', 'Melão', 'Banana', 'Maçã', 'Uva'] for fruit in fruits: yield fruit >>> my_bag = [] &g...
asked by 12.02.2016 / 00:44
2
answers

Pass parameters in pythonic form

The database driver I'm using, returns the data of a record in the form of tuple example ('João', 32, False) . I'm thinking of a pythonic way of passing this data to the constructor of a Person class, to create an object with the data cont...
asked by 06.02.2016 / 18:24
1
answer

How to convert an integer to a binary string in Python 3?

If I want to convert between integers and characters, I use chr and ord : >>> chr(10) '\n' >>> ord('$') 36 However, I need to do a test with binary strings , something new in Python 3, and I - which I onl...
asked by 29.09.2015 / 03:31
1
answer

Variable with multiple lists for array

Good evening. I have a text file where I have already converted your content to lists. Each line of the file has become a [] list, but now I need those lists all to be inside an array. This way I can not concatenate because there is only one var...
asked by 16.10.2015 / 03:30
1
answer

SyntaxError when unpacking elements of iterables

line = 'nobody:*:-2:-2:Unprivileged User:/var/empty:usr/bin/false' uname, *fields, homedir, sh=line.split(':') print fields I was doing studies in Python and I'll deal with the line so, when trying to compile I get the following message Synt...
asked by 04.12.2015 / 12:14
1
answer

How to clean the screen in TkInter?

Is there a practical way to "clean" a screen, giving destroy() to all widgets at a time, without having to do this one-by-one?     
asked by 05.08.2015 / 16:15