]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-112165: Fix typo in `__main__.py` (GH-112183) (#112185)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 17 Nov 2023 01:11:39 +0000 (02:11 +0100)
committerGitHub <noreply@github.com>
Fri, 17 Nov 2023 01:11:39 +0000 (01:11 +0000)
gh-112165: Fix typo in `__main__.py` (GH-112183)

Change '[2]' to '[1]' to get second argument.
(cherry picked from commit 8cd70eefc7f3363cfa0d43f34522c3072fa9e160)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Doc/library/__main__.rst

index 435310d525d754d4cbd75bc645d4459bd738e7e6..280af06386addfe8dd923a8d2e8e6506f0446ffe 100644 (file)
@@ -227,7 +227,7 @@ students::
     import sys
     from .student import search_students
 
-    student_name = sys.argv[2] if len(sys.argv) >= 2 else ''
+    student_name = sys.argv[1] if len(sys.argv) >= 2 else ''
     print(f'Found student: {search_students(student_name)}')
 
 Note that ``from .student import search_students`` is an example of a relative