Most voted "python" questions
Python is a dynamic and heavily typed programming language whose design philosophy emphasizes usability. Two similar but incompatible versions of Python are in use (2 and 3). Please mention the version you are using when asking a question about Python.
Learn more…8,642 questions
Sort by count of
-
2
votes1
answer119
viewsDifference between maxiter and maxfun parameters in function fmin_l_bfgs_b
In the help of function: maxfun : int Maximum number of function evaluations. maxiter : int Maximum number of iterations. But what is the maximum number of iterations and the number of function…
-
2
votes2
answers811
viewsPrinting specific lines from a text file
Imagine that I have a text file called test.txt with the following content: 4 Março 2017- Sábado meu aniversario -prova de calculo 6 Março 2017- Segunda aniversario do Salomao - fazer compras 8…
-
2
votes1
answer7641
viewsPython - Libraries for MP3
I am conducting a project based on the Python language and that requires good performance in the playback of Audios (MP3). I am currently using the PyGame with his pygame.mixer.music to be able to…
-
2
votes2
answers972
viewsPython fill values with data from other lines
Good morning, I’m having a major data failure problem in my df. I need to find the value of CO2 similar to that of another time using conditions that I am not able to do with the information on the…
-
2
votes0
answers93
views"Flake8 Crashed!" How to solve?
A few days ago, I left Pycharm on the side and started using Atom. Everything worked smoothly and today, I wrote A LINE in Python and appeared the message "flake8 Crashed!". I thought it was lack of…
-
2
votes0
answers302
viewsPython 2.7.9 - Tkinter 01 module
Hello, below you follow the source code of my program, the question is this: How do I add functions and pair/connect with the submenus after the user’s click, being the same executed in the main…
-
2
votes1
answer766
viewsCreating Python objects from the database
I’m learning Python now and want to create an object from information I picked up from the database, just passing the user ID. I am using SQL Azure and the pyodbc driver. It is working well, but I…
-
2
votes1
answer850
viewsHow to submit when pressing ENTER on a Qlineedit?
I have a certain QLineEdit in my application that when a QPushButton is clicked, the text of it is sent to the database. But I wish I could add that same event by pressing the ENTER key on that…
-
2
votes1
answer159
viewsIs it mandatory to use the pyqtSlot decorator?
When I want to connect a QPushButtonto an event, for example, I use a method and add it as event callback clicked.connect For example: def buildUi(self): self.buttonSubmitText =…
-
2
votes1
answer474
viewsQueue Logic - Python
I have a question on a question, and I hope you can help me, the question itself is not how to develop the question, that is not the problem, the problem is in the logic of the question that I am…
-
2
votes1
answer5400
viewspq the while True loop accesses if and Else in sequence to every complete loop in that code?
#! /usr/bin/python3 valor = int(input("Digite o valor a pagar: ")) cedulas = 0 atual = 50 apagar = valor while True: if atual <= apagar: apagar = apagar - atual cedulas += 1 else: print("%d…
-
2
votes1
answer96
viewsGping must be called as first argument
if __name__ == '__main__': top_100_domains =…
-
2
votes1
answer620
viewsUsing glob in Python
I am mounting a client that will play the found files in a folder for a SOAP Webservice This Webservice has two methods that we will call MET1 and MET2. When found files end with . XML and start…
-
2
votes2
answers593
viewsWhat is the difference between project ("project") and application ("app") in Django?
I had done some tests as Django framework a while ago, and only now that I tested it again, I noticed that there are two commands, which ended up confusing me: django-admin startproject…
-
2
votes1
answer309
viewsWhat is the function of the -m Python option?
To find out what version of Django I have installed, I use the following command on the terminal: python -m django --version What is the function of the option -m of this command?…
pythonasked 7 years, 11 months ago Thiago Krempser 1,878 -
2
votes1
answer755
viewsHow to save images to a server folder via sockets using python and opencv?
Hello I’m new in programming and I would like to know how to save images, (captured by opencv) in a folder created by code inside the server, I know you can do this with sockets but I have no idea…
-
2
votes1
answer439
viewsDjango Urlconfs name parameter
In Urlconf below: urlpatterns = [ url(r'^$', views.index, name='index'), ] What is the function of the parameter name? It is possible to explain with a practical example?…
-
2
votes1
answer721
viewsTransform int to python byte
Hello, Need to transform a value int to byte. I tried to do it this way: import serial ser = serial.Serial('/dev/ttyACM0', 9600) angulo = 90 ser.write(angulo) #while 1 : print ser.readline() I need…
-
2
votes2
answers1631
viewsHow to install Numpy via PIP windows 7 64 bit
Good afternoon as I do to install Numpy via Pip. I downloaded Python 2.7.13 and do not know how to install via Pip.
-
2
votes3
answers21057
viewsread text file and generate lists for each line with element separation
Quote in python, I have for example the following lines in a text file: 1,Janian,0,5,6,7,8,9 2,ana,01,9,5,6,8,1 and wanted to generate lists: list1 = [1,'Julian',0,5,6,7,8,9] Lista2 =…
-
2
votes2
answers1670
viewsHow to fix Requests encoding in Python?
I’m studying Requests in Python and I’m trying to get the data from the zip code: http://api.postmon.com.br/v1/cep/ I can pick up, but when it comes time to show them, how I live in São Paulo…
-
2
votes1
answer322
viewsWhat’s wrong with my Python code?
I’m trying to create a simple project for study purposes but I’m having a hard time completing it. I’m using the library Pytube to download videos, I can download the videos but I can’t show the…
-
2
votes1
answer865
viewsPython to C++ conversion
I work on my course with C++, and wanted to use a Python class variable access feature. See an example: class Telefone: nums = {} def __init__(self, numero): self.num = numero Telefone.nums[numero]…
-
2
votes1
answer222
viewsDeploy to Heroku PYTHON/DJANGO application giving error
I made a change to the default auth of Django and my project is working properly but when I give git push Heroku master and then use the command Heroku run python Manage.py migrate to create my…
-
2
votes1
answer1639
viewsHow to use the statistical distributions of scipy and matplot via array
Hello, I need to plot graphs of some statistical distributions using python3, so I checked in the scipy documentation, from there, after making some changes to my needs, I got the following code to…
-
2
votes1
answer391
viewsHow can a colormap of a surface be mapped to a scalar function?
Translation of question I asked in the OR: I have a scalar function that represents the electrical potential on a spherical surface. I want to plot , for a given radius, the surface and map its…
-
2
votes1
answer574
viewsPercentage in the result
I am making a menu in Python and I need the result of an account to appear in percentage.... O Tmar has value 2 and Tcliclo has value 7 being the result: 0.29 however I can’t place it at 29%. Could…
-
2
votes2
answers4682
viewsHow to replace letter typed in python?
hello to everyone I want to develop a script that replaces one typed letter with another, so it would look like a = and , b = f . I spent some time trying to create an algorithm for this function…
-
2
votes1
answer1306
viewsPython / Django interval of hours
I need to create a schedule of hours: I have the following information in the Django template: Initial time: 08:00 Final time: 18:00 Break in minutes 00:30 I would have been able to implement…
-
2
votes2
answers83
viewsRoot account error Math.sqrt with multiplication and division
I’m making an interface with buttons in Python, but after writing the account was error... I tried to redo and is giving indentation error. What I need is the code is correct? Follows the code! try:…
-
2
votes2
answers399
viewsProblem with while repetition structure
I made this little code so he’d ask for a username and a password. If the data were the same as those defined within the code, show a "success", if the user is different from the one placed in the…
-
2
votes2
answers1095
viewsAdd a new value at the beginning of a pandas series
How do I add a new value to a pandas series? I made the copy of the dataframe series and now I need to add a new value to the series swap_hoje, but instead of being at the end of the series, I need…
-
2
votes1
answer725
viewsRemove duplicate dates by summing the values
I need to remove duplicate dates from the dataframe and add the values corresponding to those dates. I found an answer in the NA stack that approaches what I need, but I couldn’t shape it for my…
-
2
votes3
answers1432
viewsPrint element from a specified position in the list
I need to get you to print the August days number on the list, but without using the: def how_many_days(month_number): """Returns the number of days in a month. WARNING: This function doesn't…
-
2
votes3
answers4694
viewsHow is the structure of projects in python?
I would like to know if there is a pattern or good practices as to how to structure a Python project. For example, I will make a CRUD using MVC. Something very simple. In JAVA I would create a…
-
2
votes2
answers5610
viewsMP3 player with Python
I know almost nothing about programming and so I have been studying new possibilities, such as POO and the like. Recently gave me a desire to try to learn GUI and also to create an MP3 player, all…
-
2
votes1
answer249
viewsExpression to remove URL links from twitter tweet
I wonder if anyone knows any expression to remove links that are present in a file . CSV in Python language. Text ex: Joao was in the market http://scikit-learn.org/stable/modules/genera I want that…
pythonasked 7 years, 10 months ago thiago xavier 339 -
2
votes1
answer4262
viewsLatex and Python integration
I need to generate and save a PDF file with some data I treated in a script I did to generate report, however, I do not know how to do it. Do these data need to go through a . tex file before…
-
2
votes1
answer1506
viewsRunning external programs with Python
I would like to reduce the size of several Mp3 files in a directory with: ffmpeg -i k.mp3 -acodec libmp3lame -ac 2 -ab 16k -ar 44100 k_.mp3 where K is the name of the Mp3 (k from 1 to 8): I tried…
-
2
votes1
answer116
viewsDisplaying total connections to a certain IP address
I have a network dump (PCAP file) containing attacks slowloris. The following script will show the number of connections to IP 192.168.1.2 on port 80: /usr/sbin/tcpdump -anr myfile.pcap | sed…
-
2
votes2
answers30328
viewsHow to run a . py program by python IDLE on Windows?
I’m learning to code in python and I’ve made a small program, but I can’t run it through the python terminal (IDLE or sheel) program name:salario_real.py error…
-
2
votes1
answer7183
viewsTkinter Window Management (Python)
i am making a code in which the main window has 4 buttons (Create, Manage, Delete and About) and I wanted at the time I click the button create isse to the creation tab without having to open…
-
2
votes1
answer559
viewsError installing Python applications on Ubuntu 17.04
I want to put Jango, I’ve done all the process and everything, but when I do Pip install Django or other things related to python, always give this error. marcos@MarcosViana:~$ sudo apt-get -f…
-
2
votes2
answers113
viewsGenerator Expressions
Good, I’ve been trying to optimize my code and I found Enerator Expressions, only I don’t understand any of it. For example: for mCp in mWithoutNone: for ctt in moradasCTT: if mCp[3] == ctt[3]:…
-
2
votes1
answer774
viewsHow to Update the value of a variable?
I made a function in which has an initial variable and according to which the user marks a checkbutton she takes this value stores in the variable and then picks and checks its value and deletes the…
-
2
votes2
answers1580
viewsImport CSV and convert date in dd/mm/yyyy format to yyyy-mm-dd
I’m a complete beginner in programming, both in Python and Sql, so I have some questions that may seem basic. I get a file. CSV that comes a lot of information not compatible with Sql so always have…
-
2
votes1
answer205
viewsHow to place a class within a JSON
Does anyone know how to put a class inside a JSON file? I need to save a class within a JSON file, however, it returns that this file is not serializable. Does anyone know how I can get this class…
-
2
votes1
answer146
viewsForeign Key Rendering in Django
I am using Createview on Jango and rendering my components with Tweak widget I would like to know if you have any way to exchange this first combo option rendered form in the template {%…
-
2
votes3
answers3149
viewsJSON does not return utf-8
I am using freegeoip to know my location and use it in my program, but when I make a call using: r = requests.get(location_url, headers={"content-type":"application/json;charset=UTF-8"}) The return…
-
2
votes2
answers4641
viewsHow to install Opencv
i would like to know how to install the latest version of Opencv 3.2 on linux Ubuntu 14.04. I was able to install and put to compile in codeblocks using C++ following a tutorial. But my goal is to…