mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 15:00:18 +00:00
added right-justified format specifier
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
line_number = 1
|
||||
with open('examples/favorite-people.txt', encoding='utf-8') as a_file:
|
||||
for a_line in a_file:
|
||||
print('{} {}'.format(line_number, a_line.rstrip()))
|
||||
print('{:>4} {}'.format(line_number, a_line.rstrip()))
|
||||
line_number += 1
|
||||
|
||||
Reference in New Issue
Block a user