Posts by jsbueno • 30,668 points
811 posts
-
5
votes1
answer4825
viewsA: Manipulation of Excel in python
Unable to "update an Excel file" In fact, Excel itself only writes a new Excel file - it is impossible to update data on a file of the type used in Excel - xlsx - "in place". First, when talking…
-
8
votes1
answer374
viewsA: Does multiple assignment in Python use tuples?
Yes - in the language specification, and to understand the syntax, it is understood that "a tuple is constructed, its elements consumed as an iterator in attribution, and the tuple, being without…
-
0
votes1
answer275
viewsA: Error in exchange for elements in the matrix
The problem there must be in how you create this data structure that you call "matrix" - In fact, you have a list of lists - that could be used the way the snippet of code you present wants to do…
-
1
votes1
answer385
viewsA: How do version control ( git, version control) using notebook jupyter?
That - basically, Jupyter stores all session data in type files .ipynb. So it’s these files that you have to keep versioned. For this it is important to stop the Jupyter server (I do not know his…
-
1
votes1
answer450
viewsA: Save Captured Data and Executed Commands with Python
Yes - you are correct - the dataframe is just an object in memory - and if the program stops for any reason, all data is lost. Furthermore, the size of the dataframe is limited to the size of the…
-
1
votes1
answer118
viewsA: Quick doubt with Collate on Mariadb
The data stored in the Database has to be in a format that stores the necessary information without ambiguity, but does not have to have no relationship at all how your application presents this…
-
1
votes1
answer465
viewsA: How to save a work in python so you don’t have to run everything every time you open the script?
Yes - the way is to actually use a serialization like Pickle, but it’s not so much work - (actually, Jupyter has a shortcut to run all cells in sequence - are you using this? It shouldn’t be too…
-
0
votes1
answer118
viewsA: Attributeerror- Sqlalchemy Flask
I was able to understand your problem - you need to practice a little with the language, and understand the difference of strings, variables and attributes - It’s not because the attribute name you…
-
1
votes2
answers508
viewsA: Phyton wait pause
Over a Pattern to interlink a function call to each line I put general considerations about your problem in the other answer. To address more directly the question of "how to repeat a task after…
-
1
votes2
answers508
viewsA: Phyton wait pause
In short: in the end, yes, for what you want, you will have to call a function to check the keyboard between each line of the program. It’s very difficult to give a concrete answer to an abstract…
-
1
votes1
answer558
viewsA: Vscode ASCII Standard Sequences (ANSI)
First of all, these are "ANSI" sequences, not "ASCII". As for your question - the problem is Windows that does not enable these sequences by default - they work on Mac, Linux, and other…
-
0
votes1
answer101
viewsA: Python - multithreading + csv
the variables "vars" and "content" are global so they will be accessed in parallel in all threads. You don’t talk and you don’t show how they’re created, you can’t know and you can’t give the right…
-
1
votes2
answers626
viewsA: Ways to initialize struct’s
C is a medium/low level language with no direct object support. The structs are a very nice way to indicate to the compiler a layout of a memory area, and with syntax to fill and edit several fields…
-
0
votes1
answer37
viewsA: Is it possible to add element to that list inside the for?
If you need to access a list, put it in a variable. Direct use of range in a for, with or without enumerate, will create a sequence that will be used only by for. In case that code would just be:…
-
2
votes1
answer171
viewsA: Python isset check (details)
checking if a key exists in a dictionary Python dictionaries use the operator in to check whether a key exists or not - then a if could turn out like this: if not 'authenticated' in jsons or not…
-
0
votes1
answer22
viewsA: Problem: No name 'departments' in module 'funcionario.apps'
Well, the error is self-descriptive. What he says is that there is the name "department"- the prefix .apps tells Python - the language - that in the directory where this file is - that possibly is…
-
1
votes1
answer245
viewsA: Dictionary from list index
If you want an automatic index update, as you are writing, you do not have the slightest need for a dictionary. In the list the dynamic change of indexes happens naturally - if, if you will access…
-
3
votes1
answer126
viewsA: How does the life cycle and visibility of the Flask object work. g?
The object g is visible only in the scope of the request and it is released from memory as soon as the request is completed? Yes. Object g is visible between Blueprints? Yes. It exists while in the…
-
2
votes1
answer81
viewsA: Delete a range of values in python
His logic is reversed, or tells how we express the problems colloquially in Portuguese. If you say programmatically - as above, you want only values greater than 18 and and values less than 6, the…
-
3
votes1
answer183
viewsA: Is it possible to define async as the initializer method of a Python class?
As you have noticed, no, it is not possible ordinarily. So we have to use the extra-ordinary rejections to disposition in language. Turning a function into an async or a Generator is much less…
-
0
votes1
answer573
viewsA: 'int' Object is not subscriptable, I have tested several times but whenever text I receive this message
This error appears because you are trying to use an object that is an integer as if it were a list or a dictionary, using brackets after the same - let’s assume that the object is in the variable x…
-
1
votes1
answer116
viewsA: Python 3 Startup Issues after Deletion of Extra Files in Project Folder
Python3 has no problem. As you can see, the error is "Java", as in the message "java.io.Filenotfoundexception: C: Users Dikson.Pycharmedu2018.3 config port (Access denied) " - which alias tells the…
-
0
votes1
answer84
viewsA: module 'Docker' has no attribute 'Client'
Most likely there is that you have in your project some file called docker.py - and command and import loads this file in place of the library docker installed in the Python environment. Just rename…
-
5
votes1
answer155
viewsA: What justified adding the syntax for positional-only parameters to Python version 3.8?
I think the biggest motivation is to mirror on the Python side what is already possible to do a long time ago when writing a function in C, to be used in Python. For example, functions such as…
-
1
votes1
answer969
viewsA: Concept of Simple Circular List
I wanted to know how this process works from that next pointer of the last element points to the first element of the list? Here’s how it works: the next element pointer in the list points to the…
-
7
votes5
answers1328
viewsA: How to create folders in python desktop
Summary Working with directories in the shell is different from working with directories from within a program - transplanting commands will not work. Even so, there are specific things in the use…
-
1
votes1
answer507
viewsA: I cannot list the unique values of the dataframe
Hiding the middle of the dataframes is a standard Pandas configuration, since most of the time it doesn’t make sense to see dates "in the middle" - seeing the beginning and the end can have an idea…
-
2
votes1
answer340
viewsA: How to publish a python application
You will send your sources to the servedr, And you have no problem with that. In fact you have the wrong concerns - and since your question only has two lines, I cannot understand which concepts you…
-
5
votes1
answer49
viewsA: Simplficando chained comparisons
Because Python has a very cool comparison Feature that allows more than one comparison to the same element to be written in the same notation that we use in mathematics. So, if we want to know if a…
-
1
votes2
answers611
viewsA: How to overwrite a method
You didn’t tell us everything - where is the student "Claudio" created? This code has problems, but it should print only the information about the student "Jubilee" - you must be calling the…
-
3
votes2
answers2002
viewsA: Python binary search algorithm
The biggest problem in your attempt is what you’re doing: meio = int(((a[i] + a[n]) / 2)) This takes the element of "a" at position "i", and the element of a at position "n" and averaged - When you…
-
3
votes1
answer146
viewsA: ANSI in Visual Studio Code with Python
On windows terminals, ansi sequence support is not enabled. The easiest way to make it work is to import the outsourced library "Colorama" (pip install colorama), and, at the beginning of your…
-
5
votes2
answers816
viewsA: In requests, how to correctly read the ISO-8859-1 encoding?
In fact, the requests already makes the decoding for you,using the correct encoding. It’s only instead of accessing the attribute .content, access the attribute .text of the object "": In [382]:…
-
1
votes1
answer1188
viewsA: How to leave a single version of Python on Linux/Ubuntu?
TL;DR: You don’t have to worry about that - which versions of Python are installed for internal system use (in this case Ubuntu) are a problem of it. To work with Python you must learn to manage…
-
1
votes1
answer71
viewsA: How can I just let my page access the file
If you don’t want to expose any content that your view code is accessing in a URL that would go public, just put this content privately in any folder, except in the Static. Maybe you have learned…
-
3
votes1
answer310
viewsA: How to change numbers on the same Python line of execution?
The terminal where print displays its contents is a special program that can have several capabilities - they are activated depending on the control codes you send inside the string itself in print.…
-
3
votes1
answer228
viewsA: What is the difference between the behavior of a static method, normal method and class method?
As for your confusion: In almost every case, you need a "normal method": this is - an instance method, with no decorator, that will receive the "self" - an instance of the class, as first parameter.…
-
3
votes1
answer1587
viewsA: sha1 encryption with python
All cryptographic functions work on hashes, not on text. Since the same text can have several different representations as bytes, depending on the encoding chosen. The encoding used throughout the…
-
2
votes1
answer234
viewsA: Problem with Python Thread Print
Create your own print function that uses a thread lock - that’s enough. print_lock = threading.Lock() original_print = __builtins__.print def print(*args, **kw): with print_lock:…
-
0
votes1
answer121
viewsA: Limit array size on screen
You are apparently confusing things - mention Numpy’s options, but say "table", and your variable has the name df, which is usually used for Pandas dataframes (which is not the same library,…
-
3
votes1
answer23
viewsA: How to Format a Date of Bytes(Pyhon)
import datetime cert =crypto.load_certificate(crypto.FILETYPE_PEM,open(cert_file).read()) enc_date = cert.get_notAfter().decode("ascii") date = datetime.strptime(enc_date, '%Y%m%d%H%M%SZ')…
-
6
votes3
answers2125
viewsA: Format Time in a Python data frame
I believe the simplest way is to recreate all column values with a datetime.time object that copies the time, minute and seconds and ignores the microseconds of the original column. I like to put…
-
2
votes1
answer758
viewsA: Python- How to better store input (date) entries?
Option Database Maybe the best thing for you is to use a database. It can be the same Sqlite, which already comes with Python. Now database is not a magic formula. It is cool because it allows you…
-
7
votes2
answers208
viewsA: What is the actual implementation of "in" in Python?
The Python interpreter is maintained by hundreds of volunteers over decades. Although it is a complex software, and of course far from perfect, in general for simple and obvious thing, like "stop…
-
1
votes2
answers469
viewsA: Insert header in Python worksheet
I believe that neither the openpyxl, nor any other XLSX file creation library (or ODS, which are also spreadsheets) provides a level of control over image positioning and resizing and style-they all…
-
1
votes2
answers183
viewsA: Python - Pass parameter instead of modules in FROM declaration
It is possible to import a module with the name into a string, rather than directly typed into the code, with the built-in function __import__. The import command actually requires the name to be…
-
0
votes2
answers70
viewsA: Socket com Python
Use the normal program communication you have with the server - and put on the server some specific request to stop responding to that client if it is not authorized. It is not necessary, nor…
-
0
votes1
answer58
viewsA: How to create a website with the server pc using only Python?
To respond to small calls via HTTP with arbitrary Python functions, the simplest is to use a microframework like Flask - take a look at Flask’s own hello world -…
-
0
votes2
answers711
viewsA: Find the second highest value
I thought I’d take the max save on a variable and then locate it on the list and delete it by saving a new list without the greatest value. Then repeat the max function and find the highest value…
-
1
votes2
answers2450
viewsA: Get range of values in pandas object. Dataframe
The way to filter lines from a dataframe is to use the syntax of [ ] to select lines, but within the same place an expression that results in a series of the same size as the dataframe, with True or…