It’s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago. Trying to find a wa…
Tag: python
Do you know a Python module to read Universal File Format (UFF)? [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 2 years ago. Improve this ques…
What is the subprocess.Popen max length of the args parameter?
I am using Popen function from the subprocess module to execute a command line tool: The tool I am using takes a list of files that it then processes. In some cases, this list of files can be very long. Is there a way to find the max length that the args parameter can be? With a large number of
How do I calculate percentiles with python/numpy?
Is there a convenient way to calculate percentiles for a sequence or single-dimensional numpy array? I am looking for something similar to Excel’s percentile function. I looked in NumPy’s statistics reference, and couldn’t find this. All I could find is the median (50th percentile), but not …
Can a decorator of an instance method access the class?
I have something roughly like the following. Basically I need to access the class of an instance method from a decorator used upon the instance method in its definition. The code as-is gives: AttributeError: ‘function’ object has no attribute ‘im_class’ I found similar question/answers…
Matplotlib runs out of memory when plotting in a loop
I have a fairly simple plotting routine that looks like this: When I plot this in single iterations, it works fine. However, the moment I put it in a loop, matplotlib throws a hissy fit… This happens on iteration 2 (counting from 1), if that makes a difference. The code is running on Windows XP 32-bit w…
Get the first item from an iterable that matches a condition
I would like to get the first item from a list matching a condition. It’s important that the resulting method not process the entire list, which could be quite large. For example, the following function is adequate: This function could be used something like this: However, I can’t think of a good …
Why does datetime.datetime.utcnow() not contain timezone information?
Why does this datetime not have any timezone info given that it is explicitly a UTC datetime? I would expect that this would contain tzinfo. Answer That means it is timezone naive, so you can’t use it with datetime.astimezone you can give it a timezone like this now you can change timezones To get the c…
How do I add five numbers from user input in Python?
As a practice exercise, I am trying to get five numbers from a user and return the sum of all five number using a while loop. I managed to gather the five numbers, but the sum is not provided by my code (I get a number, but it is always double the last number). I believe the issue is with
How to disable logging on the standard error stream?
How to disable logging on the standard error stream in Python? This does not work: Answer I found a solution for this: This will prevent logging from being send to the upper logger that includes the console logging.