Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: solve ODE with sympy
Post: RE: solve ODE with sympy

You don't need sympy to solve this. Solve it with pen and paper!
Gribouillis General Coding Help 2 265 Dec-01-2023, 05:03 PM
    Thread: numbers with decimals
Post: RE: numbers with decimals

(Nov-29-2023, 07:35 AM)DPaul Wrote: Why don't they start by explaining the simplest example first ? "I want to divide x / y with a precision of 2 decimals".A part of the problem is what do you mean ...
Gribouillis Bar 7 256 Dec-01-2023, 08:54 AM
    Thread: Unpacking a dict with * or **
Post: RE: Unpacking a dict with * or **

*x is not a valid Python expression, it cannot be evaluated. What would its value be? On the other hand func(*x) is a valid expression. There is no unary operator * or **.
Gribouillis General Coding Help 4 215 Nov-30-2023, 02:51 PM
    Thread: need to compare 2 values in a nested dictionary
Post: RE: need to compare 2 values in a nested dictionar...

(Nov-29-2023, 08:30 PM)jss Wrote: i need to return True only if temperature <temperatureThresholdThe output that you want for the entire example dictionary is not clear. Can you explain it?
Gribouillis General Coding Help 2 226 Nov-30-2023, 05:41 AM
    Thread: use of shutil.copytree with ENOTDIR exception
Post: RE: use of shutil.copytree with ENOTDIR exception

(Nov-29-2023, 09:48 AM)yan Wrote: I would like to make a script to copy an entire tree for testing (folder, sub-folders, files). I need all but the files are too big in the source and I don't need w...
Gribouillis General Coding Help 2 238 Nov-29-2023, 11:15 AM
    Thread: How to remove some elements from an array in python?
Post: RE: How to remove some elements from an array in p...

If the list is sorted, you can simply use bisect which performs a logarithmic search import random import bisect # create sorted list of numbers alist = sorted(random.choices(range(10000), k=4000)) ...
Gribouillis General Coding Help 9 407 Nov-28-2023, 08:35 AM
    Thread: Why is 2/3 not just .666 repeating?
Post: RE: Why is 2/3 not just .666 repeating?

Python floats are normally represented as 64 bits binary numbers, which means that they cannot represent faithfully more than 16 decimal digits. To see the capabilities of your Python print sys.float_...
Gribouillis General Coding Help 2 215 Nov-25-2023, 10:41 PM
    Thread: module either imported by a command or itself run as a command
Post: RE: module either imported by a command or itself ...

I would simply write the main code in a function, for example # foo.py def spam(): ... def eggs(): ... def main_task(): print('Running main task') if __name__ == '__main__': main_...
Gribouillis News and Discussions 1 164 Nov-25-2023, 04:20 PM
    Thread: TypeError: 'NoneType' object is not subscriptable
Post: RE: TypeError: 'NoneType' object is not subscripta...

You are getting this message because result is None, so you are trying to access None[2] and Python does not allow that.
Gribouillis General Coding Help 4 347 Nov-24-2023, 03:50 PM
    Thread: physical problem
Post: RE: physical problem

I added at line 16 print(sigma, n)and I ran the code with python -W error. The output shows where the warning occurs Output:... -0.7000000000000153 -0.6000000000000156 -0.7000000000000153 -0.500000000...
Gribouillis General Coding Help 1 240 Nov-23-2023, 12:23 PM
    Thread: Basic Coding Question: Exit Program Command?
Post: RE: Basic Coding Question: Exit Program Command?

Use sys.exit(), and read the documentation of this function first.
Gribouillis General Coding Help 3 250 Nov-19-2023, 05:37 PM
    Thread: VSCode has become too invasive.
Post: RE: VSCode has become too invasive.

I systematically throw away invasive software, however good they are. Too many companies take advantage of their defenseless customers. It is unfair. Use free software!
Gribouillis Bar 6 426 Nov-15-2023, 05:19 AM
    Thread: Can someone help me solve this programming problem?
Post: RE: Can someone help me solve this programming pro...

(Nov-13-2023, 07:05 PM)SuchUmami Wrote: I want to ignore small changes in price that are 10% or lower than the original peak or trough. This 10% move could span over several rows, it's a cumulative ...
Gribouillis General Coding Help 6 494 Nov-14-2023, 06:48 AM
    Thread: How secure is the use of "secret" import?
Post: RE: How secure is the use of "secret" import?

You could also consider using the keyring module to safely store passwords on the user's OS, but again, it will be safe only if no hacker can obtain the same privileges as the user using this service....
Gribouillis General Coding Help 12 719 Nov-09-2023, 07:57 AM
    Thread: How secure is the use of "secret" import?
Post: RE: How secure is the use of "secret" import?

(Nov-07-2023, 10:17 PM)ejwjohn Wrote: i was hoping that somewhere there was a solution that allowed you to store your "secrets" into the secure cloud then use an "import" function that allows you to...
Gribouillis General Coding Help 12 719 Nov-08-2023, 07:03 AM
    Thread: extract substring from a string before a word !!
Post: RE: extract substring from a string before a word ...

If your object is a python dict D, just do for item in D['data']: print(item['title'])
Gribouillis General Coding Help 3 296 Nov-07-2023, 10:15 PM
    Thread: A working code to upload a file using sftp?
Post: RE: A working code to upload a file using sftp?

Usually, I just spawn a subprocess that calls the lftp command.
Gribouillis Networking 3 471 Nov-07-2023, 03:35 PM
    Thread: Error Code: 1
Post: RE: Error Code: 1

(Nov-07-2023, 12:54 PM)percyy30 Wrote: For some bizarre reason, I am getting the same result... any ideas?Uninstall the package that you installed first pip uninstall http
Gribouillis General Coding Help 13 991 Nov-07-2023, 12:57 PM
    Thread: problem in using generator
Post: RE: problem in using generator

In the first code, you are invoking gen()() and Python tells you that the object returned by the call gen() is not callable.
Gribouillis General Coding Help 2 257 Nov-07-2023, 08:33 AM
    Thread: importing a module given a path to the file
Post: RE: importing a module given a path to the file

(Nov-02-2023, 07:37 PM)Skaperen Wrote: will it have a Python API?Yes it is pure Python code with an API and a command line interface.
Gribouillis News and Discussions 8 672 Nov-02-2023, 08:46 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020