예제 #1
0
"""
# Print content of sample object
content = sample.data
print("Content:\t", content)
"""

# Print word count of sample object
word_count = sample.get_word_count()
print("Word count:\t\t", word_count)

# Print character count
char_count = sample.get_char_count()
print("Char count:\t\t", char_count)

# Print alphanumeric characters count
alphanum_count = sample.get_alphanum_count()
print("Alphanum count:\t\t", alphanum_count)

# Print average word length of sample object's data
avg_word_len = sample.get_avg_word_len()
print("Average word length:\t %.2f" % avg_word_len)

# Print percentage of alphanumeric characters
alphanum_percentage = sample.get_alphanum_percentage()
print("Alphanum percentage:\t", round(alphanum_percentage, 2), "%")

# Print blank line percentageo
blank_count = sample.get_char_appearances('\n\n')
lines_count = sample.get_char_appearances('\n')
blank_percentage = blank_count / lines_count * 100
print("Blank line percentage:\t", round(blank_percentage, 2), "%")