Replace a list with another list in a file

0

I am having difficulty doing step 4, I want to create a code that takes links in a file and substitutes for others in an HTML already preformatted with variables @link1@, @link2@..., but it returns the error: AttributeError: 'list' object has no attribute 'replace'

#Passo 1 - Lê arquivo com links
arquivo_open = open(path_links, "r")
arquivo = arquivo_open.readlines()

#Passo 2 - Lê HTML
html_open = open(path_html, 'w')

#Passo 3 - Cria os variáveis que serão substituídas
var = ['@links_' + str(i) + '@' for i in range(1,11)]

#Passo 4 - Procura VAR e substitui por ARQUIVO
for url in enumerate(arquivo):
    html.replace(var[0], arquivo[0])
    
asked by anonymous 17.04.2018 / 20:26

0 answers