mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
bpo-45975: Simplify some while-loops with walrus operator (GH-29347)
This commit is contained in:
parent
25bc115df9
commit
024ac542d7
28 changed files with 41 additions and 153 deletions
|
@ -1099,10 +1099,7 @@ if __name__ == '__main__':
|
|||
toaddrs = prompt("To").split(',')
|
||||
print("Enter message, end with ^D:")
|
||||
msg = ''
|
||||
while 1:
|
||||
line = sys.stdin.readline()
|
||||
if not line:
|
||||
break
|
||||
while line := sys.stdin.readline():
|
||||
msg = msg + line
|
||||
print("Message length is %d" % len(msg))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue