diff --git a/pandas/io/html.py b/pandas/io/html.py index b8cb6679a9562..da149705eb8e7 100644 --- a/pandas/io/html.py +++ b/pandas/io/html.py @@ -103,7 +103,7 @@ def _get_skiprows(skiprows): elif skiprows is None: return 0 raise TypeError( - "%r is not a valid type for skipping rows" % type(skiprows).__name__ + f"{repr(% type(skiprows).__name__)} is not a valid type for skipping rows" ) @@ -133,7 +133,7 @@ def _read(obj): except (TypeError, ValueError): pass else: - raise TypeError("Cannot read object of type %r" % type(obj).__name__) + raise TypeError(f"Cannot read object of type {repr(type(obj).__name__)}") return text diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index 7403e6d254d03..24343d7b28680 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -913,8 +913,8 @@ def _get_options_with_defaults(self, engine): pass else: raise ValueError( - "The %r option is not supported with the" - " %r engine" % (argname, engine) + f"The {repr(argname)} option is not supported with the" + f" {repr(engine)} engine" ) else: value = _deprecated_defaults.get(argname, default) @@ -3607,8 +3607,8 @@ def __init__(self, f, colspecs, delimiter, comment, skiprows=None, infer_nrows=1 if not isinstance(self.colspecs, (tuple, list)): raise TypeError( - "column specifications must be a list or tuple, " - "input was a %r" % type(colspecs).__name__ + f"column specifications must be a list or tuple, " + f"input was a {repr(type(colspecs).__name__)}" ) for colspec in self.colspecs: