【发布时间】:2019-03-19 13:55:17
【问题描述】:
我需要在 API 列表上迭代一个列表,更改它的值并打印出结果。
my_endpoint = [
'/this/is/endpoint/a',
'/this/is/endpoint/b',
'/this/is/endpoint/c',
'/this/is/endpoint/d',
'/this/is/endpoint/e',
'/this/is/endpoint/f']
change_value = ['1','185','454']
我想使用 change_value 中的值更改 my_endpoint 中的“端点”部分。我想要的结果如下:
'/this/is/1/a',
'/this/is/1/b',
'/this/is/1/c',
'/this/is/1/d',
'/this/is/1/e',
'/this/is/1/f']
'/this/is/185/a',
'/this/is/185/b',
'/this/is/185/c',
'/this/is/185/d',
'/this/is/185/e',
'/this/is/185/f']
'/this/is/454/a',
'/this/is/454/b',
'/this/is/454/c',
'/this/is/454/d',
'/this/is/454/e',
'/this/is/454/f']
【问题讨论】:
-
你有没有尝试过,例如一个简单的 for 循环?