biglazycat's recent timeline updates
biglazycat

biglazycat

V2EX member #504999, joined on 2020-08-23 03:21:34 +08:00
biglazycat's recent replies
result = list(enumerate(ha))

for i in result[3::9]:
if ha[i[0]] == '0' and ha[i[0] + 1] == '0':
print(f"ha[{i[0] + 5}]: {ha[i[0] + 5]}")
Nov 23, 2020
Replied to a topic by WaterWestBolus Python Python3 正则表达式问题
>>> s="![](/img/2020pic/02/1.jpg) 以及: ![](/img/2020pic/02/2.png)"
>>> re.findall(r'[/\w]+\/\w+\.\w+', s)
['/img/2020pic/02/1.jpg', '/img/2020pic/02/2.png']
@weyou 大神好厉害,牛 B 。
Oct 24, 2020
Replied to a topic by WaterWestBolus Python Python3 正则表达式问题
line = "![](/img/2020pic/02/1.jpg) 以及: ![](/img/2020pic/02/2.png)"
pattern = re.compile('\((\S+)\)')
result = pattern.findall(line)
print(result)
Oct 24, 2020
Replied to a topic by qwa2013 Python Python 去重
Oct 24, 2020
Replied to a topic by qwa2013 Python Python 去重
import os
import re

domain_dict = {}
with open('mail.txt', encoding='utf-8') as f:
for line in f:
domain = re.split('@|:', line)[1]
domain_dict.setdefault(domain,[]).append(line)
for v in domain_dict.values():
print(v[0])

写的挺丑的,有更好的,我再回来贴上。
Sep 12, 2020
Replied to a topic by css3 Python 还得请教 Python 一个 dict 问题
mylist= {"key1": [{'a': '1'}, {'b': '2'}], "key2": [{"a": 2}, {"c": 4}]}

result = {}
for key, val in mylist.items():
for i in val:
result.setdefault(list(i)[0],[]).append(key)
print(result)
Sep 12, 2020
Replied to a topic by songdg Python 判断是否字母的问题
def in_alphabet(char):
char = str(char)
if char.islower():
return 'LowerCase'
elif char.isupper():
return 'UpperCase'
else:
return 'NotInAlphabet'

print(in_alphabet('a'))
print(in_alphabet('A'))
print(in_alphabet(1))

写的很粗糙,目前的理解就写样了。请多多指教。
from datetime import datetime

time_list = []
now = datetime.now()
start_day_hour = int(now.strftime('%Y%m%d00'))
stop_day_hour = int(now.strftime('%Y%m%d%H'))
for i in range(start_day_hour, stop_day_hour + 1):
time_list.append(i)

print(time_list)
@weyou 大神,没看懂,请指点指点。
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1177 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 23ms · UTC 18:06 · PVG 02:06 · LAX 11:06 · JFK 14:06
♥ Do have faith in what you're doing.