Python Archive
Writing to Files: File object is providing write() method to write contents into file. We use either write mode or append mode to write the information. If we open the file in write mode and …
Append mode(“a”) : Opens file in append mode. If file is present, it will place the cursor at the end of existing data to add new contents. If file is not present, it creates new …
CSV file reading: CSV Stands for “Comma Separated Values” CSV is an alternate to MS-Excel sheet Text file always stores textual information. It is not recommended to store and process record type information using Text …
Serialization and De-Serialization: In Object oriented applications, we store information in the form of Objects. We use files to store information in textual format. Object contains the information – using dynamic variables – also called …
How can we check the data of binary file? We need to perform de-serialization programmatically to get the actual information of that binary file. Pickle.load() function is used to perform de-serialization. Load() function returns Object …
Lambda expressions: Expression is a line of code. Expression is a collection of operands and operators. ‘lambda’ is a keyword. ‘lambda’ expressions are used to define a function with single line Generally we define function …
Regular Expressions: Regular expressions are used to extract the required information from the given input String using expressions. “re” is a pre-defined module. “re” module providing pre-defined functions to implement regex in python. Some of …
re.match(pattern, string): This method finds match if it occurs at start of the string. re.match(pattern, string, flags=0) flags: Represent properties or rules to follow while matching the pattern. We can specify different flags using bitwise …
Search(): match() checks only at the beginning of the string while search() checks for a match anywhere in the string. Here you can see that, search() method is able to find a pattern from any …
findall(): It returns the list of duplicates in the input string for specified pattern. It returns List of elements. Check this code: