Every line of 'python save file to folder' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
39 def save_file(self, data, path): 40 """Stores string data to a file at given path""" 41 filepath = os.path.join(self.base_path, path) 42 43 with open(filepath, "w+") as file: 44 data = file.write(str(data)) 45 return data
59 def set_save_folder(folder): 60 """ 61 Sets the folder in which lyrics will be downloaded and saved. 62 63 :param folder: string. 64 Folder path. 65 :return: string. 66 Folder path. 67 """ 68 if not folder: 69 folder = os.path.join(os.path.expanduser("~"), 'Documents', 'LyricsMaster') 70 else: 71 folder = os.path.join(folder, 'LyricsMaster') 72 return folder