-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add script for printing example.test.txt #1
Conversation
Because there is a lot of diffrent version we need to know on which version is current program
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, remember to squash commit: 0ae7b73
@@ -0,0 +1,3 @@ | |||
with open('example.test.txt', 'r') as file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what mode did you open this file? text or binary
with open('example.test.txt', 'rt') as file:
@@ -0,0 +1,3 @@ | |||
with open('example.test.txt', 'r') as file: | |||
for line in file: | |||
print(line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use logging library
@@ -1,3 +1,3 @@ | |||
with open('example.test.txt', 'r') as file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please squash with previous commit
@@ -1,4 +1,8 @@ | |||
file_name = 'example.test.txt' | |||
from sys import argv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, don't use sys.argv, use dedicated library: argparse
@@ -5,4 +5,4 @@ | |||
|
|||
with open(file_name, 'r') as file: | |||
for line in file: | |||
print(line) | |||
print(len(line), line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update this string to be more readable, like:
f'lenght={len(line)}, string={line}'
|
||
with open(file_name, 'r') as file: | ||
for line in file: | ||
print(len(line), line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please strip newline from line
What has changed?
Add new script that prints content of example.test.txt or any text file
How it was achieved?
By adding new
printer.py
script which can be run viapython printer.py
How to test it?
Create example file, and check is output from program same