← Previous Next →

Print parameters

Created by Julien Palard

Instructions

Write a script which prints its own file name.

Warning

You should work on this exercise with your own installation of Python, on you computer. Learn how for Mac OSX or Windows.

Have a look at sys.argv and how to import it.

Example

julien@localhost$ python3 solution.py
solution.py
julien@localhost$ mv solution.py solution2.py
julien@localhost$ python solution2.py
solution2.py

mv is a terminal command (OSX, Linux) renaming or moving a file. For Windows, its equivalent is move.