only deal with text files writing to files to create filecall the open(function pass it two argumentsa string for the name of the fileand the string 'wto tell the open(function you want to open the file in --write|mode the open(function returns file objecttextfile open('hello txt'' 'if you run this code from the interactive shellthe hello txt file that this function creates will be created in the same folder that the python exe program is in (on windowsthis will probably be :\python if the open(function is called from py programthe file is created in the same folder that the py file is in the --write|mode tells open(to create the file if it does not exist if it does existthen open(will delete that file and create newblank file this is just like how an assignment statement can create new variableor overwrite the current value in an already existing variable this can be somewhat dangerous if you accidentally send filename of an important file to the open(function with 'was the second parameterit will be deleted this could result in having to reinstall the operating system on your computer and/or the launching of nuclear missiles the file object has method called write(which can be used to write text to the file just pass it string like you would pass string to the print(function the difference is that write(does not automatically add newline character ('\ 'to the end of the string if you want to add newlineyou will have to include it in the stringtextfile open('hello txt'' 'textfile write('this will be the content of the file \nhello world!\ 'to tell python that you are done writing content to this fileyou should call the close(method of the file object (although python will automatically close any opened file objects when the program ends textfile close(