Increment number in string

后端 未结 5 1654
孤独总比滥情好
孤独总比滥情好 2021-01-14 09:14

I am trying to get the following output until a certain condition is met.

test_1.jpg
test_2.jpg
..
test_50.jpg

The solution (if you could remotely call

5条回答
  •  温柔的废话
    2021-01-14 09:23

    Update for Python v3.6+ - using formatted string literals:

    for n in range(1,51):
        print(f'test_{n}')
    

提交回复
热议问题