我正在使用 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
提交
取消