大鹏

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

2022年4月28日

摘要: 字符 1、字符转换 1 def check(s): 2 if len(s) <= 8: 3 return 0 4 a, b, c, d = 0, 0, 0, 0 5 for item in s: 6 if ord('a') <= ord(item) <= ord('z'): 7 a = 1 8 el 阅读全文
posted @ 2022-04-28 07:51 pf42280 阅读(19) 评论(0) 推荐(0)

摘要: 未掌握之题 一、简单 ~~~~~~~~ 二、中等 1、 HJ16 HJ24 2、 阅读全文
posted @ 2022-04-28 07:41 pf42280 阅读(26) 评论(0) 推荐(0)

摘要: 列表 1、回文子串变形1 # str = input() # n = len(str) # list = [] # for i in range(0,n-1): # for j in range(1,n): # if str[j] == str[i] and str[i+1:j] == str[j- 阅读全文
posted @ 2022-04-28 07:35 pf42280 阅读(20) 评论(0) 推荐(0)

摘要: 内置函数 1、Int的用法 import re def change_ipaddr(ip): ip = ip.split(".") res = '' for i in ip: i = bin(int(i))[2:].rjust(8,'0') res +=i return int(res,2) def 阅读全文
posted @ 2022-04-28 06:55 pf42280 阅读(41) 评论(0) 推荐(0)

摘要: 正则表达式 1、findall的用法 HJ33 import re def change_ipaddr(ip): ip = ip.split(".") res = '' for i in ip: i = bin(int(i))[2:].rjust(8,'0') res +=i return int( 阅读全文
posted @ 2022-04-28 06:50 pf42280 阅读(30) 评论(0) 推荐(0)

摘要: 字符串的用法 1、rjust、join、zfill、split、replace的用法,和正则表达式的用法 HJ33 import re def change_ipaddr(ip): ip = ip.split(".") res = '' for i in ip: i = bin(int(i))[2: 阅读全文
posted @ 2022-04-28 06:48 pf42280 阅读(49) 评论(0) 推荐(0)