当前位置:网站首页>Batch import of pictures into WPS table by date
Batch import of pictures into WPS table by date
2022-06-28 06:24:00 【The king's Lamb】
List of articles
Get the creation date of pictures in batch
import os
import time
import xlsxwriter
path = "testpic"
file = ' data ' + '.xlsx' # Save table name
i=1
workbook = xlsxwriter.Workbook(file)
worksheet = workbook.add_worksheet('sheet1')
list =os.listdir(path)
for pic in list:
timeStamp=os.path.getmtime(r"F:\Python\testpic\%s"%pic)
timeArray = time.localtime(timeStamp)
otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
worksheet.write(f'A{
i}',otherStyleTime)
i+=1
workbook.close()
The test image 
Get the creation time and fill in the table 
Batch import pictures
import xlsxwriter
import os
file = 'importpicure' + '.xlsx' # Save table name
list =os.listdir("testpic")
print(list)
i=1
workbook = xlsxwriter.Workbook(file)
worksheet = workbook.add_worksheet('sheet1')
for pic in list:
worksheet.insert_image(f'A{
i}', f'testpic/{
list[i-1]}',{
'x_scale': 0.0705, 'y_scale': 0.1015, 'x_offset': 0, 'y_offset': 0}) # Appoint A Column ,x、y Scale to
i=i+1
workbook.close()
Final rendering

【 Reference material 】
python System path placeholder timeStamp=os.path.getmtime(r"F:\Python\testpic\%s"%pic)
python Use xlsxwriter Circular direction excel The operation of inserting data and pictures in
python Convert timestamp to time _Python The conversion between time stamp and date
边栏推荐
- FPGA - 7 Series FPGA selectio -08- oserdese2 of advanced logic resources
- 报错--解决core-js/modules/es.error.cause.js报错
- Select trigger event from easyUI drop-down box
- Configure multiple database connections using the SSM framework
- 选拔赛题目代码
- Interpretation of Blog
- Paper recommendation: efficientnetv2 - get smaller models and faster training speed through NAS, scaling and fused mbconv
- Linked list (II) - Design linked list
- 5-minute NLP: summary of time chronology from bag of words to transformer
- Error reporting - resolve core JS / modules / es error. cause. JS error
猜你喜欢

Introduction to browser tools: think sky browser, team work browser

【Paper Reading-3D Detection】Fully Convolutional One-Stage 3D Object Detection on LiDAR Range Images

death_satan/hyperf-validate

链表(一)——移除链表元素

AutoCAD C polyline small acute angle detection

Socket. Io long Connection Push, version Control, Real - Time Active user volume Statistics

Oracle condition, circular statement

Openharmony gnawing paper growth plan -- json-rpc

FPGA - 7系列 FPGA SelectIO -07- 高级逻辑资源之ISERDESE2

Alert pop-up processing in Web Automation
随机推荐
慢内容广告:品牌增长的长线主义
链表(三)——反转链表
链表(二)——设计链表
使用SQL select count distinct查询语句统计数据库中某个字段的唯一值总数量
整型提升和大小端字节序
自定义 cube-ui 弹出框dialog支持多个且多种类型的input框
CAD secondary development +nettopologysuite+pgis reference multi version DLL
Example of MVVM framework based on kotlin+jetpack
@The reason why the Autowired annotation is empty
Error reporting - resolve core JS / modules / es error. cause. JS error
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException:异常解决
[untitled]
easyui 重置多条件查询
整型提昇和大小端字節序
Idea generates entity classes from database tables
Alert pop-up processing in Web Automation
ImportError: cannot import name 'ensure_ dir_ Possible solutions for exists'
链表(一)——移除链表元素
Lombok @equalsandhashcode annotation how to make objects The equals () method compares only some attributes
Socket. Io long Connection Push, version Control, Real - Time Active user volume Statistics