1,文本内容如图一:
文件内容
2,程序代码
with open('rizhi.txt')as f:
contents = f.read()
a_list1 = []
t = contents.replace('\n',',')
x = t.split(',')
for rin x:
href ='https://www.amazon.com/dp/{0}'.format(r)
print(href)
3,运行结果如图:
运行结果

备注:记录换行,替换等
with open('rizhi.txt')as f:
contents = f.read()
a_list1 = []
t = contents.replace('\n',',')
x = t.split(',')
for rin x:
href ='https://www.amazon.com/dp/{0}'.format(r)
print(href)