<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      python 排版模塊



      # 科技類(lèi)文本
      # 用阿拉伯?dāng)?shù)字連續(xù)編號(hào),不同層次的數(shù)字之間加下圓點(diǎn)相隔(即圓點(diǎn)加在數(shù)字的右下角),最后數(shù)字后面不加標(biāo)點(diǎn),如“1”“1.1”“1.1.1”……

      # 人文類(lèi)文本
      # 第一層用“一、”,第二層用“(一)”,第三層用“1.”,第四層用“(1)”,第五層用 “ ① ”

      class Typesetting():
      def __init__(self,text):
      self.text = ''.join(text)
      def division(self,i,t):
      if i < len(self.text)-1:
      # A. a.
      if t.encode('utf-8').isalpha() == True and self.text[i+1] == '.' :
      return True
      # A、 a、
      elif t.encode('utf-8').isalpha() == True and self.text[i+1] == '、' :
      return True

      # 1、 一、
      elif self.text[i - 1].isnumeric() == False and t.isnumeric() == True and self.text[i + 1] == '、':
      return True
      # 11、 一十、
      elif t.isnumeric() == True and self.text[i+1].isnumeric() == True and self.text[i+2] == '、' :
      return True

      # 1. 一.
      elif self.text[i - 1] != '.' and self.text[i - 1].isnumeric() == False and t.isnumeric() == True and \
      self.text[i + 1] == '.' and self.text[i + 2].isnumeric() == False:
      return True
      # 11. 一十.
      elif self.text[i-1] != '.' and t.isnumeric() == True and self.text[i+1].isnumeric() == True and self.text[i+2] == '.' :
      return True

      # 1.1.1.1
      elif t.isnumeric() == True and \
      self.text[i + 1] == '.' and \
      self.text[i + 2].isnumeric() == True and \
      self.text[i + 3] == '.' and \
      self.text[i + 4].isnumeric() == True and \
      self.text[i + 5] == '.' and \
      self.text[i + 6].isnumeric() == True:
      return True
      # 11.1.1.1
      elif t.isnumeric() == True and \
      self.text[i + 1].isnumeric() == True and \
      self.text[i + 2] == '.' and \
      self.text[i + 3].isnumeric() == True and \
      self.text[i + 4] == '.' and \
      self.text[i + 5].isnumeric() == True and \
      self.text[i + 6] == '.' and \
      self.text[i + 7].isnumeric() == True:
      return True
      # 11.11.1.1
      elif t.isnumeric() == True and \
      self.text[i + 1].isnumeric() == True and \
      self.text[i + 2] == '.' and \
      self.text[i + 3].isnumeric() == True and \
      self.text[i + 4].isnumeric() == True and \
      self.text[i + 5] == '.' and \
      self.text[i + 6].isnumeric() == True and \
      self.text[i + 7] == '.' and \
      self.text[i + 8].isnumeric() == True:
      return True
      # 11.11.11.1
      elif t.isnumeric() == True and \
      self.text[i + 1].isnumeric() == True and \
      self.text[i + 2] == '.' and \
      self.text[i + 3].isnumeric() == True and \
      self.text[i + 4].isnumeric() == True and \
      self.text[i + 5] == '.' and \
      self.text[i + 6].isnumeric() == True and \
      self.text[i + 7].isnumeric() == True and \
      self.text[i + 8] == '.' and \
      self.text[i + 9].isnumeric() == True:
      return True

      # 1.1.1
      elif self.text[i-1] != '.' and t.isnumeric() == True and self.text[i+1] == '.' and self.text[i+2].isnumeric() == True and self.text[i+3] == '.' and self.text[i+4].isnumeric() == True :
      return True
      # 11.1.1
      elif self.text[i - 1] != '.' and \
      t.isnumeric() == True and \
      self.text[i + 1].isnumeric() == True and \
      self.text[i + 2] == '.' and \
      self.text[i + 3].isnumeric() == True and \
      self.text[i + 4] == '.' and \
      self.text[i + 5].isnumeric() == True:
      return True
      # 11.11.1
      elif self.text[i - 1] != '.' and \
      t.isnumeric() == True and \
      self.text[i + 1].isnumeric() == True and \
      self.text[i + 2] == '.' and \
      self.text[i + 3].isnumeric() == True and \
      self.text[i + 4].isnumeric() == True and \
      self.text[i + 5] == '.' and \
      self.text[i + 6].isnumeric() == True:
      return True

      # 1.1
      elif (self.text[i-1] == '。' or self.text[i-1] == ',') and self.text[i-1] != '.' and t.isnumeric() == True and self.text[i+1] == '.' and self.text[i+2].isnumeric() == True :
      return True
      # 11.1
      elif (self.text[i - 1] == '。' or self.text[i - 1] == ',') and self.text[i - 1] != '.' and t.isnumeric() == True and self.text[i + 2].isnumeric() == True and self.text[i + 3] == '.' and self.text[i + 4].isnumeric() == True:
      return True

      # (1) (一)
      elif t == '(' and self.text[i+1].isnumeric() == True and self.text[i+2] == ')' :
      return True
      # (11) (一十)
      elif t == '(' and self.text[i + 1].isnumeric() == True and self.text[i + 2].isnumeric() and self.text[i + 3] == ')':
      return True


      # ① 暫未解決 無(wú)法用isnumeric()函數(shù) 雖然對(duì)此符號(hào)可識(shí)別但是也對(duì)其他數(shù)字識(shí)別所以會(huì)造成混亂
      elif t in ['①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩',
      '⑴','⑵','⑶','⑷','⑸','⑹','⑺','⑻','⑼','⑽','⑾','⑿','⒀','⒁','⒂','⒃','⒄','⒅','⒆','⒇',
      '⒈', '⒉', '⒊', '⒋', '⒌', '⒍', '⒎', '⒏', '⒐', '⒑', '⒒', '⒓', '⒔', '⒕', '⒖', '⒗', '⒘', '⒙', '⒚', '⒛',
      ] :
      return True

      # 第1章 第一章
      elif t == '第' and self.text[i+1].isnumeric() == True and self.text[i+2] == '章' :
      return True
      # 第11章 第一十章
      elif t == '第' and self.text[i + 1].isnumeric() == True and self.text[i + 2].isnumeric() == True and self.text[i + 3] == '章':
      return True

      # 第1節(jié) 第一節(jié)
      elif t == '第' and self.text[i+1].isnumeric() == True and self.text[i+2] == '節(jié)' :
      return True
      # 第11節(jié) 第一十節(jié)
      elif t == '第' and self.text[i + 1].isnumeric() == True and self.text[i + 2].isnumeric() == True and self.text[i + 3] == '節(jié)':
      return True


      # 1)二)
      elif self.text[i-1] != '(' and t.isnumeric() == True and self.text[i+1] == ')':
      return True
      # 11)二十)
      elif self.text[i - 1] != '(' and t.isnumeric() == True and self.text[i + 1].isnumeric() == True and self.text[i + 2] == ')':
      return True

      # 1)、 一)、
      elif t.isnumeric() == True and self.text[i+1] == ')' and self.text[i+2] == '、':
      return True
      # 11)、 一十)、
      elif t.isnumeric() == True and self.text[i + 1] == ')' and self.text[i + 2].isnumeric() == True and self.text[i + 3] == '、':
      return True


      def start(self):
      str = ''
      for i,t in enumerate(self.text):
      if self.division(i,t) == True :

      str = '%s\n%s' % (str,t)
      # print(str)
      else:
      str = '%s%s' % (str, t)
      return str
      text = open('text.txt','r',encoding='utf-8').read()
      #調(diào)用編譯模塊
      a = Typesetting(text).start()
      print(a)
      # text = open('text.txt','w',encoding='utf-8')
      # text.write(a)
      posted @ 2022-08-16 15:10  記錄——去繁就簡(jiǎn)  閱讀(90)  評(píng)論(0)    收藏  舉報(bào)
      主站蜘蛛池模板: 自拍亚洲综合在线精品| 亚洲电影天堂在线国语对白| 国产精品综合色区av| 中文字幕人妻不卡精品| 狠狠色婷婷久久综合频道日韩| 日本欧美一区二区三区在线播放| 黑人大群体交免费视频| 男女xx00xx的视频免费观看| 亚洲gv天堂无码男同在线观看| 国产高颜值极品嫩模视频| 洞口县| 亚洲国语自产一区第二页| 亚洲中文字幕成人综合网| 日韩精品av一区二区三区| 久久天天躁狠狠躁夜夜婷| √新版天堂资源在线资源| 影音先锋啪啪av资源网站| 果冻传媒色av国产在线播放| 国产一级小视频| 国产偷拍自拍视频在线观看| 久久久久综合中文字幕| 日韩中文字幕亚洲精品| 亚洲婷婷综合色高清在线 | 日本又色又爽又黄的a片吻戏| 亚洲国产成人无码网站大全| 国产日韩精品欧美一区喷水| 国产亚洲av产精品亚洲| 国产午夜福利视频一区二区| 亚洲伊人情人综合网站| 中文字幕有码日韩精品| 国产二区三区不卡免费| 亚洲一区二区三区四区三级视频 | 成人嫩草研究院久久久精品| 果冻传媒一区二区天美传媒| 中文字幕在线精品视频入口一区| 日韩秘 无码一区二区三区| 特级做a爰片毛片免费看无码| 国产av剧情md精品麻豆| 91精品国产蜜臀在线观看| 国产精品一区二区久久精品无码| 97久久综合亚洲色hezyo|