Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

question about -i

I receive this when I try to use -i

treehouse:~/workspace$ -i wish.py
bash: -i: command not found

what it means?

I resolved the last thing, but now I got this: treehouse:~/workspace$ python -i wish.py

adrianalunch = "N{TACOS}"
adrianalunch
'N\{TACOS}'

Can you post the code in wish.py?

1 Answer

-i is a command that you give to python when you run python. It tells Python to enter interactive mode after it runs whatever script you give it. For example, let's say I have this script:

something.py
print("We ran this file!")
number = 1

Now, if we run this file like this:

python -I something.py

We'll see "We ran this file!" get printed out, and we'll also have an interactive Python prompt where we can write whatever other Python code we want. In this prompt, we can see that there's a variable defined called number whose value is 1. At this point, it's like we're writing new code at the bottom of something.py and executing it live