- The readline() method reads one entire line from the file. A trailing newline character is kept in the string. If the size argument is present and non-negative, it is a maximum byte count including the trailing newline, and an incomplete line may be returned.
- Reading: cat.
Creating the new file : touch.
Deletion of the file : rm.
List the file in current directory: ls. - Following is the answer:
os.system(“shell_command”)
subprocess.getstatusoutput(“shell_command”)
- Following is the answer:
import configparser as config
config.set(section, option, value)
- Following is the answer:
psutil, fabric, salt, asnible, buildbot, shinken
- Following is the answer:
input()
sys.stdin.readline()
- Use list.sort() when you want to mutate the list, sorted() when you want a new sorted object back. Use sorted() when you want to sort something that is an iterable, which is not a list yet. For lists, list.sort() is faster than sorted() because it doesn't have to create a copy.