2025-09-10:仓库迁移

This commit is contained in:
2025-09-10 16:12:45 +08:00
parent e0e49b0ac9
commit 3130e336a1
146 changed files with 4066 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
from numpy.core.defchararray import startswith
if __name__ == '__main__':
str = "https://www.baidu.com"
str2 = "http://www.baidu.cn"
str3 = "suka"
# 如果想要在字符串首进行匹配,可以使用:
is_start_with_https = str.startswith("https")
print(is_start_with_https)
# 这会输出一个布尔值,
## 比如上面匹配成功就会输出True
# 同理可以设置endswith
is_end_with_dotcom = str.endswith(".com")
print(is_end_with_dotcom)
# 如果想要匹配多种开头和结尾,可以将函数输入改成元组()
is_url = [url for url in [str, str2, str3] if url.startswith(('http', 'https'))]
print(is_url)
# 当然,复杂的操作还请使用正则表达式进行匹配,不过简单的检查用这个方法那是又快又好