-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tool for count the number of characters in a tex tile.
- Loading branch information
Lucas Ayres
committed
Jul 1, 2018
1 parent
c39133e
commit 2270464
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
def count_characters(file): | ||
"""Count the number of characters in a text file. | ||
Args: | ||
file (str): Path of a fext file. | ||
Returns: | ||
int: Return number of characters in a text file. | ||
""" | ||
with open(file) as f: | ||
lines = f.readlines() | ||
return len(''.join([l for l in lines])) |