我希望能夠打印到一個文本文件,但是我環顧四周,無法弄清楚我需要做什麼。打印成一個文本文件循環
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