Nikhil

Count Occurrences of a character in String in Python

In this article, we will learn to count the number of occurrences of a character in a given string using Python. Table Of Contents What are Strings ? Count occurrences of a character in string using count(): Count occurrences of a character in string using collections.counter(): Count occurrences of a character in string using re.findall()

Count Occurrences of a character in String in Python Read More »

Get filename without extension from a path in Python

In this article, we will learn to extract the filename from a give file without the extension of the file. Table Of Contents Using rfind() method : Using splitext() method: Using the split() method: Using Basename() method : Using pathlib.Path.stem() method : A Pathname consists of name of the file, location at which the file

Get filename without extension from a path in Python Read More »

Scroll to Top