python 笔记(一)

xiaoxiao2025-10-19  3

1、判断文件是否存在

os.path.exists(myFileUrl)

2、取点字符串前后的空格

"   uusda    ".strip()

>>> uusda

3、全部大写自负全字母(upper(),lower(),title() 单词的第一个字符大写 其余全小写)

"asdYre".upper()

>>>ASDYRE

4、判断列表中key在列表中的索引位置

list = ['q3w','rty']

list.index('rty')

>>> 1

转载请注明原文地址: https://www.6miu.com/read-5038209.html

最新回复(0)