技术学习PythonPython编程快速上手Python《Python编程快速上手》6.4 项目:在 Wiki 标记中添加无序列表Ramsayi2022-01-222024-01-13bulletPointAdder.py - 在 Wiki 标记中添加无序列表12345678910111213#! python3# bulletPointAdder.py - 在Wiki标记中添加无序列表# 每行文字都在剪贴板中。import pypercliptext = pyperclip.paste()# 分割行并添加星号lines = text.split('\n')for i in range(len(lines)): # 遍历“行”列表中的所有索引 lines[i] = '* ' + lines[i] # 为“行”列表中的每个字符串添加星号text = '\n'.join(lines)pyperclip.copy(text) 示例文本1234Lists of animalsLists of aquarium lifeLists of biologists by author abbreviationLists of cultivars 输出1234* Lists of animals* Lists of aquarium life* Lists of biologists by author abbreviation* Lists of cultivars