Skip to content

Tag: arguments

How can I open a folder with argparse

I want to open a folder containing x zipfiles. I have this code: But I get error code: PermissionError: [Errno 13] Permission denied: ‘Test’ I would like the zipfiles in the folder to be listed in an array when I run the code. Answer I’m not sure why you’re getting a permission error, but using open on a directory won’t

Variable Length Arguments (*args) in Python3

I am fairly new to Python3. I have a question with Variable Length Arguments(*args). Based on my understanding the reason why we use the Variable Length Arguments list(or tuple) is that they are useful when you need a function that may have different numbers of arguments. A function like this gives the same output as output I don’t see the

random number generating function as argument in python

I want to pass a function which generates random normal numbers to another function, do some calculations and pass again the random function x times. At the end there should be a Dataframe with x colums with diffrent randomly generated outcomes. My code looks like this: But this gives me always identical columns. Answer I don’t think you can pass

Output is an empty file

My code does not throw an error, it simply creates the files, but of which are empty. I tried it from the command line, and it works using the wildcard training_set_pssm/*.pssm path, but I must do it from the IDE because it is not printing the correct output anyway. The input file is a set of checkpoint files that look

Python Function parameters and arguments

I want to understand functions and arguments better, I’ve read and this is my implementation of what I have read. I have 3 small functions to illustrate my point. User input collection, grading function and main. If I run the main function without its argument (1), it results in an error looking for the argument. I know that I declared