摘要:
filename = 'pi_digits.txt' with open(filename) as file_object: lines = file_object.readlines() for line in lines: print(line.rstrip()) open() 接受的参数是当前 阅读全文
摘要:
class Dog: """A simple attempt to model a dog.""" def __init__(self, name, age): """Initialize name and age attributes.""" self.name = name self.age = 阅读全文
摘要:
cars = ['audi', 'bmw', 'subaru', 'toyota'] for car in cars: if car == 'bmw': print(car.upper()) else: print(car.title()) if语句 得到的值是Treu 或者 False 注意首字母 阅读全文