鱼C论坛

 找回密码
 立即注册
查看: 2469|回复: 2

[作品展示] 精华3.0

[复制链接]
发表于 2022-8-23 21:53:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
利用了pyperclip库

  1. import pyperclip


  2. def scan(string):
  3.     if len(string) > 30:
  4.         i = 0
  5.         for ch in string:
  6.             if ch == '。':
  7.                 return scan(string[0: i]) + scan(string[i + 1: len(string) - 1])
  8.             i += 1
  9.         print('太长了')
  10.         return ''
  11.     return_string = ''
  12.     is_chinese = False
  13.     for ch in string:
  14.         if '\u4e00' <= ch <= '\u9fff':
  15.             if is_chinese:
  16.                 return_string += ' '
  17.             return_string += ch
  18.             is_chinese = False
  19.         elif ch == ',':
  20.             return_string += ch
  21.             is_chinese = False
  22.         elif ch == '。':
  23.             is_chinese = False
  24.         elif is_chinese:
  25.             return_string += ch
  26.         else:
  27.             return_string += ' ' + ch
  28.             is_chinese = True
  29.     if string[-1] == "%":
  30.         pyperclip.copy(return_string + ' 。\n')
  31.     elif string[-1] == "!" or string[-1] == "?" or string[-1] == "." or string[-1] == ":":
  32.         pyperclip.copy(return_string)
  33.     pyperclip.copy(return_string + '。\n')


  34. def first_title(string):
  35.     pyperclip.copy('[align=center][size=5][b]' + string + '[/b][/size][/align]')


  36. def second_title(string):
  37.     pyperclip.copy('[size=4][b]' + string + '[/b][/size]')


  38. def third_title(string):
  39.     pyperclip.copy('[size=3][backcolor=DarkSlateGray][color=White]' + string + '[/color][/backcolor][/size]')
复制代码



输入完 scan(),*_title() 就可以直接到帖子里 ctrl + v 了。

精华2.0
https://fishc.com.cn/thread-216900-1-1.html
(出处: 鱼C论坛)

评分

参与人数 1荣誉 +5 鱼币 +5 贡献 +3 收起 理由
python爱好者. + 5 + 5 + 3 鱼C有你更精彩^_^

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2022-8-24 04:51:44 | 显示全部楼层
建议以后加上 图形界面 与 爬虫(直接在IDLE里远程控制fishc.com网站)
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-8-24 08:03:29 | 显示全部楼层
python爱好者. 发表于 2022-8-24 04:51
建议以后加上 图形界面 与 爬虫(直接在IDLE里远程控制fishc.com网站)

知道,正在学requests
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-30 18:22

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表