Python | os.fsdecode() method Last Updated : 25 Jun, 2019 Comments Improve Suggest changes Like Article Like Report OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality. os.fsdecode() method in Python is used to decode the specified filename from the filesystem encoding with 'surrogateescape' error handler, or 'strict' on Windows; Syntax: os.fsdecode(filename) Parameter: filename: A path-like object representing an encoded file. A path-like object is either a str or bytes object representing a path. Return Type: This method returns a string which represents the decoded filename. Code: use of os.fsdecode() method Python3 # Python program to explain os.fsdecode() method # importing os module import os # Filename encoded to the filesystem encoding # with 'surrogateescape' error handler # or 'strict' error handler filename = b"/home / user / F\xc3\x8e\xe2\x95\x9a\xc3\x88.txt" # Decode the above filename # form the filesystem encoding # with 'surrogateescape' error handler, # or 'strict' (On Windows) decode = os.fsdecode(filename) # Print the decoded filename print("Decoded filename:", decode) # To encode a filename to the filesystem # encoding with 'surrogateescape' error handler # or 'strict' error handler os.encode() method # can be used Output: Encoded filename: b'/home/user/F\xc3\x8e\xe2\x95\x9a\xc3\x88.txt' Decoded filename: /home/user/FÎ?È.txt Reference: https://docs.python.org/3/library/os.html#os.fsdecode Comment More infoAdvertise with us Next Article Python | os.fsdecode() method I ihritik Follow Improve Article Tags : Python python-os-module Practice Tags : python Similar Reads Python | os.fsencode() method OS module in Python provides functions for interacting with the operating system. OS comes under Pythonâs standard utility modules. This module provides a portable way of using operating system dependent functionality. os.fsencode() method in Python is used to encode the specified filename to the fi 1 min read Python | os.fchmod() method OS module in Python provides functions for interacting with the operating system. OS comes under Pythonâs standard utility modules. This module provides a portable way of using operating system dependent functionality.In Unix-like systems, Modes are file system permissions given to user, group and o 3 min read Python | os.lseek() method OS module in Python provides functions for interacting with the operating system. OS comes under Pythonâs standard utility modules. This module provides a portable way of using operating system dependent functionality. os.lseek() method sets the current position of file descriptor fd to the given po 3 min read Python | os.fsync() method OS module in Python provides functions for interacting with the operating system. OS comes under Pythonâs standard utility modules. This module provides a portable way of using operating system dependent functionality.os.fsync() method in Python is used to force write of the file associated with the 2 min read Python | os.close() method OS module in Python provides functions for interacting with the operating system. OS comes under Pythonâs standard utility modules. This module provides a portable way of using operating system dependent functionality. os.close() method in Python is used to close the given file descriptor, so that i 2 min read Python | os.fchdir() method OS module in Python provides functions for interacting with the operating system. OS comes under Pythonâs standard utility modules. This module provides a portable way of using operating system dependent functionality. os.fchdir() method in Python is used to change the current working directory to t 3 min read Python | os.getcwd() method OS module in Python provides functions for interacting with the operating system. OS comes under Pythonâs standard utility modules. This module provides a portable way of using operating system dependent functionality. All functions in os module raise OSError in the case of invalid or inaccessible f 2 min read Python | os.getcwdb() method OS module in Python provides functions for interacting with the operating system. OS comes under Pythonâs standard utility modules. This module provides a portable way of using operating system dependent functionality. All functions in os module raise OSError in the case of invalid or inaccessible f 1 min read Python | os.makedev() method OS module in Python provides functions for interacting with the operating system. OS comes under Pythonâs standard utility modules. This module provides a portable way of using operating system dependent functionality. os.makedev() method in Python is used to compose a raw device number from the giv 3 min read Python | os.fstat() method OS module in Python provides functions for interacting with the operating system. OS comes under Pythonâs standard utility modules. This module provides a portable way of using operating system dependent functionality. os.fstat() method in Python is used to get the status of a file descriptor. A fil 3 min read Like