Re: What’s the differences between these two pieces of code ?
Kwpolska
kwpolska at gmail.com
Sun Sep 9 13:07:06 EDT 2012
On Sun, Sep 9, 2012 at 3:27 PM, iMath <redstone-cold at 163.com> wrote:
> 在 2012年7月7日星期六UTC+8下午12时56分35秒,iMath写道:
>> What’s the differences between these two pieces of code ?
>>
>> (1)
>>
>> for i in range(1, 7):
>>
>> print(2 * i, end=' ')
>>
>>
>>
>> thx everyone
>>
>> (2)
>>
>> for i in range(1, 7):
>>
>> print(2 * i, end=' ')
>>
>> print()
>>
>>
>>
>>
>>
>> when executed both respectively in Python shell ,I get the same effect . Who can tell me why ?
>
> --
> http://mail.python.org/mailman/listinfo/python-list
Well, (2) is inserting an additional newline, and (1) isn’t. The
shell might not show that, but try running this as a standalone
script.
--
Kwpolska <http://kwpolska.tk>
stop html mail | always bottom-post
www.asciiribbon.org | www.netmeister.org/news/learn2quote.html
GPG KEY: 5EAAEA16
More information about the Python-list
mailing list