We can check whether a substring is present in a string using the Python find() function. If the find() function returns 0 or a positive number, the substring is present. The system of find() function. substring: The substring to be searched. start: Starting index of the range where the substring will be searched. Default value … Continue reading “Python | Find a Substring”
Category: Programming
Python | Reverse a String
In Python we can use various methods to reverse a string. Simplest way to reverse a string is to use the slice operation. Output: General syntax of slice operation is string[start:end:step]. In our program start and end are not specified. That means the whole string will be considered. As the step is -1, the string … Continue reading “Python | Reverse a String”
Python | Sleep in Milliseconds
Sleeping means suspension of the current thread execution. If a sleep statement is put between two statements, the later one will not get executed until the specified time specified in the sleep statement is elapsed. The sleep statement simply puts the thread in suspension and wait for a signal. After receiving the signal that the … Continue reading “Python | Sleep in Milliseconds”
Python | Substring
Substring is a sequence of characters within a string. In Python we can get different types of substrings using slicing operation. Syntax of Python substring: string[start:end:step] start: Starting index of the substring. The substring will include the character of this index. Starting index will be 0 if not specified. end: End index of the substring. … Continue reading “Python | Substring”
C Program to List All Files Including Subdirectories
In the previous article, we saw how to list all files in a particular directory. That program does not display the files of the subdirecties. Here we’ll see how to display the files of the current direcory and of the subdirectories. The directory stucture could be arbitarily nested. The program here will display the files … Continue reading “C Program to List All Files Including Subdirectories”