How to open a file for both reading and writing? How to read a (static) file from inside a Python package? How to get the path and name of the file that is currently executing? How to read a file into a list in Python? ![]() How to get the time a file was last modified in Python? Python tempfile module: generate temporary files/directories.Python fnmatch module: for filename matching.Python linecache module: randomly read the specified line of the file.Python fileinput module: read multiple files line by line.Python pickle module: implement persistent storage of Python objects.Python write() and writelines(): writing data to a file.Python readline() and readlines(): read files line by line.Python read(): read a file by bytes (characters).Python open a file in text/binary format.Download and Install Python third-party library using pip command.Python _file_ attribute: view the source file path of a module.Python _doc_ attribute: view documentation.Python view module (variable, function, class).Creating packages and Importing packages in Python.Python package: folders that hold multiple modules.Resolve ModuleNotFoundError while importing Python module.Python _import_() function: import module name.What is a module, Python modular programming.Proper use of Python exception handling.How to create and use custom exception in Python.Python traceback module: get exception information. ![]() Python sys.exc_info(): get exception information.Python try-except-finally: resource recycling.The underlying implementation of Python exception handling.Python generator: send, close, throw methods.Python iterator implements reverse order output of strings.Python overloads operators to implement custom sequences.Python issubclass and isinstance functions: checking types.Python setattr(), getattr(), hasattr() functions.Python _dict_ attribute: view the dictionary of all attribute names and values inside the object.Python _dir_() method: List all attribute (method) names of an object.Python _del_() method: destroying objects.Python _repr_() method: display attributes.Python Class Members (properties and methods).Python type(): dynamically create classes.Python _slots_: restrict class instance to dynamically add attributes and methods.Python super(): call the constructor of the parent class.Override method from parent class in Python.Python instance methods, static methods and class methods.Python class attributes and instance attributes.Improve code readability and appearance in Python.Use global variable with same name as local variable.Python Variable-length arguments (*args, **kwargs).Python pass-by-value and pass-by-reference.Python if else: the indentation requirements.Python encode() and decode(): string encoding conversion.Python ljust(), rjust() and center(): align text.Python index(): check whether a string contains a substring.Python find(): detect whether a string contains a substring.Python count(): count the occurrences of a string.Python len(): get string length or number of bytes.Python print(): print value on screen or to file. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |