startswith/endswith传元组用法
className = ["jd_num01","jd_num02","tx_num01", "tx_num02", "zj_num01", "ali_num01"]
for name in className:
# 可以传元组,多个参数表示|(或)的意思,同样的endswith也可以传元组
if name.startswith(("tx_", "ali_")):
print(name)
"""
tx_num01
tx_num02
ali_num01
"""
-------------------------------------------
个性签名:代码过万,键盘敲烂!!!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!