摘要:
st='hello world'print(st.count('l'))#统计元素个数:3print(st.capitalize())#首字母大写:Hello worldprint(st.center(50,'-'))#把字符串居中,50个字符除了字符串,剩下的用 # hello world pri 阅读全文
摘要:
例 1 List 解析介绍 >>> li = [1, 9, 8, 4] >>> [elem*2 for elem in li] [2, 18, 16, 8] >>> li [1, 9, 8, 4] >>> li = [elem*2 for elem in li] >>> li [2, 18, 16, 8] 为了便于理解它,... 阅读全文