Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

modul:m122:learningunits:lu10:argparse [2025/01/06 09:57] – angelegt msutermodul:m122:learningunits:lu10:argparse [2025/01/08 09:06] (aktuell) msuter
Zeile 28: Zeile 28:
     parser.add_argument('-v', '--verbose', help='Shows more information about the scripts', action='store_true')     parser.add_argument('-v', '--verbose', help='Shows more information about the scripts', action='store_true')
  
- # Parse the argument +    # Parse the argument 
- args = parser.parse_args()+    args = parser.parse_args()
  
- # Print the arguments +    # Print the arguments 
- print(f'Argument 1: {args.arg1}'+    print(f'Argument 1: {args.arg1}'
- print(f'Argument 2: {args.arg2}')+    print(f'Argument 2: {args.arg2}')
  
- # Check the verbose switch +    # Check the verbose switch 
- if args.verbose: +    if args.verbose: 
- print('Verbose mode active!')+        print('Verbose mode active!')
  
 if __name__ == '__main__': if __name__ == '__main__':
  • modul/m122/learningunits/lu10/argparse.1736153854.txt.gz
  • Zuletzt geändert: 2025/01/06 09:57
  • von msuter