我正在使用 Python 3 循环遍历包含字符串的 .txt 文件的行。这些字符串将在curl 命令中使用。但是,它仅适用于文件的最后一行。我相信其他行以换行符结尾,这会导致字符串丢失:url = https://with open(file) as f: for line in f: str = (url + line) print(str)这将返回:https://endpoint1https://endpoint2https://endpoint3如何解决所有字符串像最后一行一样连接的问题?
添加回答
举报
0/150
提交
取消