Q:

Python2.7.8 Script to print all files in a directory path.  Please help fix

I am new to python.  
I am working on a script to ask a user for a directory path.  Once provided,
I would like the script to list all files in the directory excluding any sub directories. 
Here is what I have so far.  I seem to be stuck trying to find a way to test to see if the item in question is a directory or a file.  Please help. 
#!  /usr/bin/python

import os

dir_f = raw_input(" Plese enter directory path where you would like to have \
the files renamed \n" )

#print dir_f

os.chdir(dir_f)

#prints items in directory one line at a time.  TEST section

while os.listdir(dir_f):
    if os.path.isdir(dir_f):
        continue
    else:
        print "\n".join(os.listdir(dir_f)) 

    # os.rename(src, dst) dont use this yet. 

A:

A simple code you can try, and them integrate to your needs. 
import os

folder = '/tmp/test'

for item in os.listdir('/tmp/test'):
    if not os.path.isdir(os.path.join(folder,item)):
         print item

