简体   繁体   English

Python CGI脚本如何从目录打印指向图像的链接

[英]Python cgi script how to print links to images from directory

I was wondering how you would print links to images from your directory. 我想知道您将如何打印目录中图像的链接。 I tried messing around a bit and so far it doesn't work. 我试着弄乱了一点,到目前为止还行不通。

#!/usr/local/bin/python3

print('Content-type: text/html\n')

print ('<img src="/~NAME/images/figure_1.png">')

error: 错误:

 CGIWrap encountered an error while attempting to execute this script:

Error Message: No such file or directory
Error Number: 2 

you should add single quotation. 您应该添加单引号。

- print (<img src="/~NAME/images/figure_1.png">)
+ print ('<img src="/~NAME/images/figure_1.png">')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM