Python: Relative and absolute paths
Often we need to read from, or write to, files in directories that are local to our script. For instance, we could use the below code to save to file all possible values that can be stored in one byte: my_bytes = bytearray(list(range(0,256))) with open("output/local.bin", 'wb') as f: f.write(my_bytes) Our script, local_file.py, is located in the following directory: /home/python [wintermute@hive python]$ cd /home/python [wintermute@hive python]$ ls local_file.py output Now, let's say we launch this script from within its location: [wintermute@hive python]...