18F / an_introduction_to_python

An introduction to Python - https://www.digitalgov.gov/event/online-intro-to-python/
10 stars 8 forks source link

Homework 2 creating .py files and writing to them #7

Open JosephMacula opened 7 years ago

JosephMacula commented 7 years ago

I opened up a “console” on pythonanywhere and wrote the following code: new_file = open(“create_file.py”, “w”). I know that this command will create a new file for me called create_file and that it will be stored in the current working directory. However, after hitting enter and getting a new line in the console, I’m not sure how I can write to create_file.py the code for a program that will create another file (in this case, practicing_writing_text.txt). What I did to get around this problem was to just go to my dashboard and click on the file that I just created, create_file.py, and then write the code needed to create practicing_writing_text.txt in that file. Is that how we were supposed to do this? I’m not sure if I’m missing something important here.