S
S
sega111sega2021-07-02 13:38:14
Python
sega111sega, 2021-07-02 13:38:14

How to replace a substring in a string with an element of a list?

Good day!

There is a string: string \/ ****** .jpg (the highlighted part is always the same, the asterisks are a numeric number, which can be of any size)
There is a list of numbers in which the first element always corresponds to the number from the string.

You need to get a new list of strings with all numbers.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sega111sega, 2021-07-02
@sega111sega

first_number = numbers[0]

for i in numbers:
    links = (link.replace(first_number, i)).split()

everything was much easier

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question