Exception handling in python Counting the number of characters in a string

前端 未结 0 1583
广开言路
广开言路 2020-12-21 02:25

This is my code.

def word_count(my_string): count=1 if type(my_string) == str: try: for eachCharacter in my_string: if eachCharacter==\' \': count+=1 return count exc

相关标签:
回答
  • 消灭零回复
提交回复
热议问题