乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Python

       小區(qū)木大爺 2019-05-14

      判斷字符是否以某個字符開頭和結尾

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      # -*- coding: utf-8 -*-
      # !/usr/bin/python3
      __author__ = 'beimenchuixue'
      __blog__ = 'http://www.cnblogs.com/2bjiujiu/'
      def check_str(value):
          # 檢查你輸入的是否是字符類型
          if isinstance(value, str):
              # 判斷字符串以什么結尾
              if value.endswith('.sh'):
                  return '%s 是以.sh結尾的字符串' % value
              # 判斷字符串以什么開頭
              elif value.startswith('xi'):
                  return '%s 是以xi開頭的字符串' % value
              else:
                  return '%s 不滿足以上條件的字符串' % value
          else:
              return '%s is not str' % value
           
      def main():
          str_one = 'bei_men.sh'
          resp_one = check_str(str_one)
          print(resp_one)
           
          str_two = 'xi_du.py'
          resp_two = check_str(str_two)
          print(resp_two)
           
          str_three = 233
          resp_three = check_str(str_three)
          print(resp_three)
      if __name__ == '__main__':
          main()

        本站是提供個人知識管理的網絡存儲空間,所有內容均由用戶發(fā)布,不代表本站觀點。請注意甄別內容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內容,請點擊一鍵舉報。
        轉藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多