I use Google Colaboratory then I want to save output images in my Google Drive or SSD, HHD but its directory is \"/content\"
import os print(os.getcwd())
You need to mount google drive to your Colab session.
from google.colab import drive drive.mount('/content/gdrive')
Then you can simply write to google drive as you would to a local file system like so:
with open('/content/gdrive/My Drive/file.txt', 'w') as f: f.write('content')