Cody Bable

Generation

generate functionSun, 23 Apr 2023

check if input is file, if not make it a file

def tofile(input): if isinstance(input, file): input = input.read() if not isinstance(input, str): input = str(input) with open(input, "w") as f: f.write(input) return f tofile(1)

Questions about programming?Chat with your personal AI assistant