日本語ver
Introduction
I want to display following print in Command line.apple
apple
apple
apple
apple
Miss
However, This print is not able to display following code used print script.def main():
i = 0
while i<5:
print('apple')
j = 0
while j < i:
print(' ')
j = j + 1
i = i + 1
if __name__ == '__main__':
main()
rusult…Print code change line when writing new apple.
succeed
Please, look at following code.import sys
def main():
i = 0
while i < 5:
print('apple')
j = 0
while j <= i:
sys.stdout.write(' ')
j = j + 1
i = i + 1
if __name__ == '__main__':
main()
sys.stdout.write is write string regardless of the changing line.Result!
However, I give you a strong warning that sys.stdout.weite use only str.
コメント
コメントを投稿