常见io函数 前端批量上传图片并回显;python传递list给前端,并成功显示多张图片 (轮播图形式、图片切换器)
(20条消息) flask-图片回显-多文件图片上传下载回显_huanghong6956的博客-CSDN博客
(20条消息) python传递list给前端并在前端成功显示图片·可以显示多张后台传过来的图片_居贝比的博客-CSDN博客_python 传list给前端
(20条消息) Element UI + Vue 批量上传图片(只请求一次)_西瓜坤坤坤坤的博客-CSDN博客_elementui批量上传
(20条消息) element-ui + vue 批量上传文件,接口请求一次_荻野泽溪的博客-CSDN博客_vue多文件上传一次请求
(20条消息) vue实现简单轮播图_洳娅的博客-CSDN博客_vue轮播图
使用vue实现一个简单的图片切换器 - 简书 (jianshu.com)
1. io函数意义
- os.listdir():用来获取指定文件夹中的所有文件和子文件夹名称组成的列表
shutil.copy()用于将源文件的内容复制到目标文件或目录
source = "/home/User/Documents/file.txt"
destination = "/home/User/Desktop/"
dest = shutil.copy(source, destination)
# List files and directories
# in "/home / User / Desktop"
print("After copying file:")
print(os.listdir(destination))
print("Destination path:", dest)
// 输出
After copying file:
['input.txt', 'GeeksForGeeks', 'output.txt', 'file.txt', 'web.py', 'tree.cpp']
Destination path: /home/User/Desktop/file.txt //路径最后一个文件夹复制给目标文件
- os.sep根据你所处的平台,自动采用相应的分隔符号。
-
f"{}": 字符串前面加f表示格式化字符串,加f后可以在字符串里面使用用花括号括起来的变量和表达式
- r'' 防止字符串转义
file = open('D:\\exe\\7.txt','r', encoding='utf-8')
# 两种用法一样
file = open(r'D:\exe\7.txt','r', encoding='utf-8')
-
后端给前端数据列表
图片绑定地址是定值就会显示:

如图:

如果src含有变量
图片就不显示


浙公网安备 33010602011771号