How to read the content of a file in Python
We can read the content of a file using either one of the method given below. f = open('myfile','r') print
Read MoreFor Techs.... Techniques.... Technologies....
We can read the content of a file using either one of the method given below. f = open('myfile','r') print
Read MoreThe module urllib provides the function to access web url and we can save its content to a text file.
Read MoreModule itertools provides the functionality to join list of lists into a single list. import itertools print list(itertools.chain.from_iterable(listname)) Where 'listname'
Read MoreShutil module provides the utility to copy folder and its contents recursively. from shutil import copyfile copyfile(src, dst) Here we
Read MoreWe can use boolean logic to check whether the string is empty or not. if not string: print "string
Read MoreShutil module provides the utility to remove folder and its contents recursively. import shutil shutil.rmtree(folder) Where 'folder' is the name
Read MoreThe module 'tarfile' provides the functionality to compress and extract folders. To create compressed file, import tarfile with tarfile.open('folder.tar.gz', "w:gz")
Read MoreOs module provides the utility to create folders. import os os.mkdir('folder', 0o755) Where 'folder' is the name of the folder
Read MoreOs module provides the functionality to list the contents of folders. import os os.listdir(foldername) Where 'foldername' is the name of
Read MoreOs module provides the functionality to rename files. import os os.rename(old_name,new_name) Replace the old_name,new_name accordingly.
Read MoreOs module provides the functionality to remove files. import os os.remove(filename) Here we need to replace 'filename' with the name
Read More