File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed
Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change 1616 package_dir = {"" : "src" },
1717 packages = ["cs50" ],
1818 url = "https://github.com/cs50/python-cs50" ,
19- version = "6.0.2 "
19+ version = "6.0.3 "
2020)
Original file line number Diff line number Diff line change @@ -133,17 +133,11 @@ def get_string(prompt):
133133 Read a line of text from standard input and return it as a string,
134134 sans trailing line ending. Supports CR (\r ), LF (\n ), and CRLF (\r \n )
135135 as line endings. If user inputs only a line ending, returns "", not None.
136- Returns None upon error or no input whatsoever (i.e., just EOF). Exits
137- from Python altogether on SIGINT.
136+ Returns None upon error or no input whatsoever (i.e., just EOF).
138137 """
138+ if type (prompt ) is not str :
139+ raise TypeError ("prompt must be of type str" )
139140 try :
140- if prompt is not None :
141- print (prompt , end = "" )
142- s = sys .stdin .readline ()
143- if not s :
144- return None
145- return re .sub (r"(?:\r|\r\n|\n)$" , "" , s )
146- except KeyboardInterrupt :
147- sys .exit ("" )
148- except ValueError :
141+ return input (prompt )
142+ except EOFError :
149143 return None
You can’t perform that action at this time.
0 commit comments