⚠
️ DEPRECATED GITLAB INSTANCE
⚠
️ This GitLab is now read-only for reference. Please use
https://gitlab.iauro.co
for all new work.
Migration completed on September 17, 2025
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
file parser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GEN_AI_UPSKILLING_PROGRAM
file parser
Commits
809d802b
Commit
809d802b
authored
May 27, 2025
by
Rahul Sonawane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parents
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
parser.py
parser.py
+30
-0
sample3.txt
sample3.txt
+2
-0
No files found.
parser.py
0 → 100644
View file @
809d802b
import
sys
class
FileParser
:
def
__init__
(
self
,
filename
):
self
.
filename
=
filename
self
.
ccount
=
0
self
.
wcount
=
0
self
.
lcount
=
0
self
.
count
()
def
count
(
self
):
try
:
with
open
(
self
.
filename
,
"r"
)
as
f
:
for
line
in
f
:
self
.
lcount
+=
1
self
.
ccount
+=
len
(
line
)
self
.
wcount
+=
len
(
line
.
split
())
except
Exception
as
e
:
print
(
f
"Error reading file: {e}"
)
def
report
(
self
):
print
(
f
"The file has {self.ccount} characters, {self.wcount} words and {self.lcount} lines"
)
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
!=
2
:
print
(
"Usage: py parser.py <filename>"
)
else
:
obj1
=
FileParser
(
sys
.
argv
[
1
])
obj1
.
report
()
\ No newline at end of file
sample3.txt
0 → 100644
View file @
809d802b
Hello from Rahul....
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment