Posts

basic structure of c

Image
  v    Basic Structure of C Programs: - Basic structure of c program consists of several sections. 1.        Documentation Section. 2.        Link Section. 3.        Definition Section. 4.        Global Declaration Section. 5.        Function Prototype Declaration Section. 6.        Main Function 7.        Sub Function section. 1)      Documentation Section: - Ø    Documentation section includes comments about the C program. Ø    Comments improve readability and understandability of the programmer. Ø    We can give comments about program, creation, modified date, author name, etc. in this section. Ø    Comment lines are ignored by compiler while C program was compiled. Ø    Comments can be of two ...

1.4 CSV file in Python

Image
  v   CSV file in python: - A CSV file in Python is a Comma-Separated Values file used to store tabular data in plain text format, where each line represents a row, and values in a row are separated by commas (,). Each row in the file corresponds to a record. Columns are separated by a delimiter (comma by default, but can be ;, \t, or others). CSV files are human-readable and can be opened in text editors, Excel, Google Sheets, etc. Python uses CSV module to read and write the CSV files.   1. Writing CSV files: - To write to a CS to write CSV file in Python, we use the csv.writer( ) method. The csv.writer( ) method returns a writer object that converts the user’s data into a delimited string. This string can later be used to write into CSV files using the writerow( ) method. The two methods for writing to CSV are: writerow( ): This method writes a single row at a time. Field row can be written using this method. writerows( ): This method is used t...

1.3 Pickle module in Python

Image
v   Pickle Module: - The pickle module in Python is used to serialize and deserialize Python objects. Serialization , also called pickling , is the process of converting a Python object into a byte stream so that it can be stored in a file or sent over a network. Deserialization , also called unpickling , is the process of converting a byte stream back into a Python object. The pickle module is useful for saving Python objects such as lists, dictionaries, sets, or custom objects in binary format. It can also be used to transfer Python data between programs, store program states, or save machine learning models for later use. We need to install pickle module before working upon its inbuilt methods using command prompt. The pickle module provides two methods: dump( ) and load( ). 1.   The pickle.dump( ) function serializes a Python object and writes it to a file in binary format.            ...

1.2 Binary files in python

Image
  v   Binary files in python: - A binary file is a file that stores data in the form of raw bytes (0s and 1s) instead of plain text. In Python, binary files store data in a non-text format such as images, audio files, videos, serialized objects, and more. Binary files consist of non-human-readable characters and symbols, which require specific programs to access their contents. They are stored as bytes (zeros and ones), but these bytes do not represent ASCII values of characters. Instead, they represent the actual content, such as images, audio, video, compressed files, executable files, etc. Since binary files are not human-readable, opening them in a text editor will display random or unreadable symbols, often referred to as “ garbage values ”. This happens because the computer interprets the binary content as a sequence of bytes without any text encoding. It is also difficult to remove errors from binary files, as their contents cannot be directly interpreted by humans. Py...