摘要: 1 filename = 'Car.py' 2 3 #读取整个文件 4 with open(filename) as file_object: 5 lines = file_object.read() 6 print(lines) 7 8 9 #遍历文件对象 10 with open(filename) as file_object: 11 for... 阅读全文
posted @ 2018-11-09 20:22 悦来风清 阅读(400) 评论(0) 推荐(0) 编辑
摘要: string.strip([chars]) 方法删除字符串开头和结尾指定的字符或字符序列(即不能删中间字符)。 string.lstrip([chars]) 方法删除字符串开头指定的字符或字符序列(即不能删中间字符)。(l - left - strip 左侧,即开头) string.rstrip([ 阅读全文
posted @ 2018-11-09 19:23 悦来风清 阅读(2088) 评论(0) 推荐(0) 编辑