我希望能够打印到一个文本文件,但是我环顾四周,无法弄清楚我需要做什么。打印成一个文本文件循环
def countdown (n):
while (n > 1):
print('\n',(n), 'Bottles of beer on the wall,', (n), 'bottles of beer, take one down pass it around', (n)-1, 'bottles of beer on the wall.')
n -= 1
if (n == 2):
print('\n',(n), 'Bottles of beer on the wall,', (n), 'bottles of beer, take one down pass it around', (n)-1, 'bottle of beer on the wall.')
else:
print ('\n',(n), 'Bottle of beer on the wall,', (n), 'bottle of beer, take one down pass it around no more bottles of beer on the wall.')
countdown (10)
**我看了看周围**,你有什么试过? SO不是代码写入服务。请处理你的问题,并回来一些代码。 – CrakC
这将是很好,如果你做一些网页浏览来得到这个问题的答案 – repzero