如何从 Python 中的字符串中读取特定行?例如,假设我想要以下字符串的第 2 行:
string = """The quick brown fox jumps over the lazy dog.""" line = getLineFromString(string, 2) print(line) # jumps over the
关于reading specific lines from a file有几个问题,但是我如何从字符串中读取特定行?