0

# 以names列表信息命名创建txt，以values信息写入创建的txt中、数据1写入文件1，数据2写入文件2以此类推...#

...

J_L | 初学一级 | 园豆：148

0

``````请在控制台打印如下图案：
*****
****
***
**
*
``````
〆灬丶 | 园豆：2057 (老鸟四级) | 2022-01-04 17:07
0

。。。实在不知道该说什么。。。这是刚学编程？自学？

https://q.cnblogs.com/q/137769/

@韆: 笑死，太逗了

0
``````names = ['文件{}'.format(n) for n in range(1, 11)]
values = ['{}数据{}\n'.format(n, n) for n in range(1, 11)]

def write_center(filename, center):
with open(filename, 'w') as f:
f.write(center)
f.write('{}\n{}\n'.format('二', '这是第三行数据'))

for f, c in zip(names, values):
write_center(f + '.txt', c)
``````

0

import os

# 创建答案txt 并写入从.jpg提取的信息

for file in os.listdir(path):
# print(file)
if os.path.splitext(file)[1] == ".jpg" or os.path.splitext(file)[1] == ".jpeg":
print(file)

``````        answer_data = file
# other...

# 答案取值

# 类型
blue_data = "\n蓝\n"
green_data = "\n绿\n"
yellow_green_data = "\n黄绿\n"
yellow_data1 = "\n黄\n"
yellow_data2 = "\n黄\n"
white_data = "\n白1\n"
white_data2 = "\n白2\n"
white_data3 = "\n白3\n"
black_data = "\n黑\n"
green_data2 = "\n绿\n"

# 拼接答案txt