Skip to content
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

Merged
merged 6 commits into from
Oct 25, 2022

Conversation

raidgar98
Copy link
Owner

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 via python printer.py

How to test it?

Create example file, and check is output from program same

@raidgar98 raidgar98 added enhancement New feature or request review this MR is ready for review labels Oct 16, 2022
@raidgar98 raidgar98 self-assigned this Oct 16, 2022
@raidgar98 raidgar98 marked this pull request as draft October 16, 2022 17:38
@raidgar98 raidgar98 marked this pull request as ready for review October 16, 2022 17:38
SKNGetIT
SKNGetIT previously approved these changes Oct 19, 2022
Because there is a lot of diffrent version
we need to know on which version is current
program
Copy link
Owner Author

@raidgar98 raidgar98 left a 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:
Copy link
Owner Author

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)
Copy link
Owner Author

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:
Copy link
Owner Author

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
Copy link
Owner Author

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)
Copy link
Owner Author

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)
Copy link
Owner Author

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

@raidgar98 raidgar98 merged commit 75b442d into main Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request review this MR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants