Questions tagged [args]

Common abbreviation for "arguments", often used in reference to command-line arguments or function arguments.

A program can accept any number of arguments from the command line. This allows the user to specify configuration information when the program is launched.

The user enters command-line arguments when invoking the application and specifies them after the name of the command to be run.

898 questions
-4
votes
1 answer

Why is my function running but not giving any output?

def func(*args,**kwargs): if 'fruit' in args and 'food' in kwargs: print('I would like to eat {} {}'.format(args['fruit'], kwargs['food'])) func(fruit='apple',fruit1='banana',food='biryani',dinner='meat')
-4
votes
1 answer

How to change more simple?

import argparse parser = argparse.ArgumentParser() parser.add_argument('--model1', default='resnet18', type=str) parser.add_argument('--model2', default='resnet34', type=str) parser.add_argument('--model3', default='resnet50',…
woncheol
  • 15
  • 1
  • 4
-4
votes
1 answer

Why am i getting a parse error and how can i solve this error in haskell?

I'm new to Haskell and while reading real-world Haskell I came across a problem: Q) Using the command framework from the earlier section “A Simple Command-Line Framework” on page 71, write a program that prints the first word of each line of its…
Rahat
  • 305
  • 1
  • 4
  • 10
-4
votes
1 answer

Calling a function with an uninitialised variable that I want to convert to a string

I'm a little stuck with what is probably a simple problem. There are probably several ways to resolve this issue so I thought I'd open it up to stackoverflow to suggest some different approaches. My code is below: import os root_directory =…
says
  • 111
  • 1
  • 4
  • 15
-4
votes
3 answers

Invoke method and use args[0] as an argument in that method

public class a2 { public static void main(String[] args) { isHappy(args[0]); } public static boolean isHappy(){ int i = Integer.parseInt(args[0]); if(i == 132){ return false; } } } I have…
-4
votes
1 answer

How do you decide where to write the (String[] args) line?

So this line public static void main(String[] args) is used only once per class right ? It is to allow me to use strings and anything else ? My basic understanding is that it is used to store the... strings used in that class inside it or something…
sem3456
  • 9
  • 1
-5
votes
1 answer

args and up? javasript

How would I get an arg and up? so like lets say I have something like this: args = ["!say", "pineapples", "are", "cool!"] How would I output the 2ed arg (the one after the !say part) and up? the output would be look like this: Pineapples are…
-5
votes
1 answer

A python syntax error that cannot find and answer

def calculate_money_made(**trips): total_money_made = 0 for trip_id, trip from trips.items(): trip_revenue = trip.cost - trip.driver.cost total_money_made += trip_revenue return total_money_made gives an error! cannot figure out File…
-5
votes
2 answers

Using "args" but method still not taking more than one array as parameter?

I want to make a method that takes x amount of ArrayList<> as a parameter. When I use args this does not work. Is args only reserved for int and String etc? Why does not args become a new array containing my arraylist? I thought there was a way to…
Lealo
  • 331
  • 1
  • 3
  • 11
-5
votes
1 answer

args[0]==null Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at Main.main(Main.java:69)

Trying to call the java file, and have been asked to make it so that if args[0] is empty in a terminal call, it should return all objects. Cant get it working without getting an error. else if(args[1]==null){ System.out.println("Printing…
Dank meme
  • 11
  • 4
-5
votes
3 answers

Some informations of how handle the main() args in Java

I have to develop a command line Java application in which the main() method accept 2 String parameters named respetivelly partitaIVA and nomePDF. So, as starting point, I created this simple Main class: public class Main { public static void…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
-6
votes
1 answer

String args display

I understand that String args[] inside the public static void main line, is used to store arguments from the command line. So is it possible to print what's inside args[]? I wrote code that prints from args[0] what I entered in the scanner. I know I…
Yuvi1
  • 9
  • 7
-12
votes
2 answers

What does (String args []) mean?

I have this in the File.java: public static void main(String args[]) throws Exception_Exception { URL wsdlURL = CallSService.WSDL_LOCATION; if (args.length > 0) { File wsdlFile = new File(args[0]); try { if…
Adams
  • 105
  • 4
  • 10
1 2 3
59
60