file in a current directory

This is the place for queries that don't fit in any of the other categories.

file in a current directory

Postby szostakowicz » Sat Aug 09, 2014 1:18 pm

Hi, quick question.

I was reading about modules and came across this:
"Use your favorite text editor to create a file called in the current directory [...]. Now enter the Python interpreter and import this module with the following command: import fibo."
It probably has nothing to do with Python itself but how can I create the file 'in the current directory'? What does it even mean? :shock:
Posts: 6
Joined: Tue Aug 05, 2014 5:40 pm

Re: file in a current directory

Postby metulburr » Sat Aug 09, 2014 2:29 pm

directories are folders. If your using Windows an example path would be:
Code: Select all

The same path in linux would be:
Code: Select all

This would differ from yours only in repsect to 'metulburr' would be whatever your username is on your computer. The downloads directory is just an arbitrary one.
Creating a file without specifying the directory normally creates it in what ever directory you are in at the moment (ie. the current directory). So if you were in Downloads and created a file called, the fullpath of the file would then be:
Code: Select all

At this point they are saying open the python interpreter in the directory
Code: Select all

In windows when you open a command prompt, they normally start you off in C\Windows\system32 unless you changed the default directory. So you will need to change to your directory Downloads
Code: Select all
cd C:\Users\metulburr\Downloads

Once here you can open a python interpreter. By just being in the directory Downloads when you open the interpreter, your current directory in the interpreter will be:
Code: Select all

If you have problems opening the python interpreter or the command prompt...check the tutorial here

Hopefully that explained well enough, instead of confusing you.
we will be moving to on October 1 2016
more details here
User avatar
Posts: 2244
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 8 guests