- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 27104 Articles for Server Side Programming
159 Views
In identifying and interacting with hardware devices, device numbers have a significant role in the domain of low-level systems programming. Every device or peripheral that is connected to a computer system is given or assigned a unique pair of numbers called the major and minor device numbers. You have to comprehend how to compose a raw device number from these components and this is essential when interacting with device drivers or working with devices at a low level. In this article, we will set out on a journey to explore the procedure of composing a raw device number in Python. ... Read More
223 Views
Have you ever anytime wondered how the complex world of low-level system programming deals with the issue of device identification in Python? One essential item of data is the device major number; this plays a crucial role in identifying different devices in a system. In this article, we will set out on a journey to demystify the process of extracting the device major number from a raw device number using the power of Python. By the end of this article, you'll be equipped with the knowledge to navigate the realm of device identification with confidence. Understanding Device Major Numbers Before ... Read More
769 Views
The method os.symlink(src, dst) creates a symbolic link dst pointing to src. For example, if you have a file called photo.jpg and want to create a softlink/symbolic link to it called my_photo.jpg, then you could simply use:Example>>> import os >>> os.symlink('photo.jpg', 'my_photo.jpg')Now if you list the files in that directory, you'll get the my_photo.jpg there as well.
3K+ Views
The method os.link(src, dst) creates a hard link pointing to src named dst. This method is very useful to create a copy of existing file.ExampleFor example, if you have a file called photo.jpg and want to create a hard link to it called my_photo.jpg, then you could simply use:>>> import os >>> os.link('photo.jpg', 'my_photo.jpg') Now if you list the files in that directory, you'll get the my_photo
238 Views
You have to use the fdatasync(fd) function to force write of file with filedescriptor fd to disk. It does not force update of metadata. Also note that this is only available on Unix.A more cross platform solution would be to use fsync(fd) as it force write of file with filedescriptor fd to disk. On Unix, this calls the native fsync() function; on Windows, the MS _commit() function.Exampleimport os, sys # Open a file fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT ) os.write(fd, "This is test") # Now you can use fsync() method. os.fsync(fd) # Now read this file from the beginning os.lseek(fd, ... Read More
855 Views
Filesystem information, in Python, is defined as the attributes and metadata linked with a file or directory, such as its name, size, timestamps, permissions, ownership, and type. There are various modules in Python like os and os.path to work with the file system and fetch this information. Obtaining access to filesystem information allows developers to work with files and directories, carry out operations like creation and deletion, and take informed decisions within their code. To fetch file system information using Python, you can utilize the os module; it provides several functions for interacting with the operating system. In particular, the ... Read More
187 Views
To get stat of a file, method stat() from the os module can be used. It performs a stat system call on the given path. For example,import os st = os.stat("file.dat")This function takes the name of a file, and returns a 10-member tuple with the following contents:(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)The mode variable gives you the information about file permissions. You can get it by st[0]. You can read more about interpreting the tuple here: http://effbot.org/zone/python-fileinfo.htm
638 Views
We have to realize that in the world of Python programming, obtaining file statistics plays a critical role in processing and manipulating files effectively. It does not matter if you are a novice or an experienced coder; this article will surely guide you through the process of retrieving file stats using Python. By taking a deep dive into the intricacies of file handling and unleashing the potential of Python's built-in functions, we will empower you with the knowledge to effortlessly access valuable statistical data about your files. Understanding File Stats Before we begin exploring the code examples, let us make ... Read More
181 Views
In the realm of Python programming, accessing system configuration information relevant to open files can be very useful in providing valuable insights into the operating environment. It does not matter if you are a curious developer or an avid enthusiast, this article will show you the way through the process of retrieving system configuration details related to open files using Python. By taking advantage of several Python's built-in modules and functions, we will unlock the ability to gather essential information about files in a seamless and efficient manner. We will learn this skill by discussing and practicing several code examples ... Read More
5K+ Views
The act of copying files to a new directory is a basic skill that every developer in Python should invariably possess. Whether it is the process of backing up data, organizing files or creating a new project, there are powerful tools provided by Python to make file copying an easy task. In this extensive article, you will learn the process of copying files to a new directory using Python. Detailed explanations and practical code examples, will help you gain the knowledge and confidence to handle file copying tasks successfully. Understanding File Copying Before we begin with the examples ... Read More