python / psf-infra-meta

Meta-repository for PSF backed or managed systems. Created mainly for the issue tracker :)
11 stars 7 forks source link

argparder_documentation_error #113

Closed sarkissian001 closed 3 years ago

sarkissian001 commented 3 years ago

An issue in Introducing Positional arguments documentation. URL - https://docs.python.org/3/howto/argparse.html

The following code will return a type error:

import argparse parser = argparse.ArgumentParser() parser.add_argument("square", help="display a square of a given number") args = parser.parse_args() print(args.square**2)

This should be changed to:

import argparse parser = argparse.ArgumentParser() parser.add_argument("square", help="display a square of a given number") args = parser.parse_args() print(int(args.square)**2)