想要使用 python 将 url 链接添加到 .csv 数据源
我浏览了当前的相关问题,但没有找到与我的需求类似的内容。
我正在使用 zencart 创建联属商店 - 现在的问题之一是 zencart 不是为重定向和联属商店而设计的,但它可以做到。我将改变商店,使其像展示价格的展示店一样。
有一个名为 easy populate 的 mod,它允许我上传数据源。这一切都很好,但是我的附属链接不会出现在每个产品中。我可以在上传数据源并转到每个产品,然后将其添加为带有重定向链接的图像后手动执行此操作 - 但是,当有超过 500 个项目时,这将是一项长期重复且耗时的工作。
有人告诉我,我可以在将数据上传到 zencart 之前将链接添加到数据源,这应该使用 python 来完成。我已经读了好几天有关 python 的文章了,感觉我在寻找错误的东西。我想知道是否有人可以建议我完成这项工作的最简单方法。
我希望这个问题有意义,
谢谢
abs
ive looked through the current related questions but have not managed to find anything similar to my needs.
Im in the process of creating a affiliate store using zencart - now one of the issues is that zencart is not designed for redirects and affiliate stores but it can be done. I will be changing the store so it acts like a showcase store showing prices.
There is a mod called easy populate which allows me to upload datafeeds. This is all well and good however my affiliate link will not be in each product. I can do it manually after uploading the data feed and going to each product and then adding it as an image with a redirect link - However when there are over 500 items its going to be a long repetitive and time consuming job.
I have been told that I can add the links to the data feed before uploading it to zencart and this should be done using python. Ive been reading about python for several days now and feel im looking for the wrong things. I was wondering if someone could please advise the simplest way for me to get this done.
I hope the question makes sense
thanks
abs
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 csv 模块制作一个 python 脚本,如下所示:
您需要知道如何链接应该格式化,希望它可以使用 csv 文件中存在的其他参数来组成。
You could craft a python script using csv module like this:
You need to know how link should be formatted hoping that it could be composed using the other parameters present on csv file.
首先,按照 systempuntoout 告诉您的方式使用 CSV 模块,其次,您需要将标题更改为:
执行此操作的方法很大程度上取决于您的网站实现。在纯 Python 中,您可能会使用 HttpResponse 对象来做到这一点。在 django 中也是如此,但有一些快捷方式。
您可以在 showmedo 上找到如何使用 Python 创建 CSV 文件的视频。然而它不是免费的。
现在,要提供下载 CSV 的链接,这取决于您的网站。它背后的技术是什么:纯Python、Django、Pylons、Tubogear?
如果您无法回答这个问题,您应该在尝试对其进行更改之前向您的老板询问有关您的基础架构的培训。
First, use the CSV module as systempuntoout told you, secondly, you will want to change your header to:
The way to do it depends very much of your website implementation. In pure Python you would probably do that with an HttpResponse object. In django, as well, but there are some shortcuts.
You can find a video demonstrating how to create CSV files with Python on showmedo. It's not free however.
Now, to provide a link to download the CSV, this depends of your Website. What is the technology behinds it : pure Python, Django, Pylons, Tubogear ?
If you can't answer the question, you should ask your boss a training about your infrastructure before trying to make change to it.