Okay, I’m a noob when it comes to Python, I have to learn this for work.. And so far, I’m looking at some small programs to list directories.
I’m using Python 3.2.1.. In the Python Shell, I make a new window and I put:
import glob
print glob.glob("/*.txt")
But when I “run module”, I save it, and it always tells me Invalid syntax, and it highlights the 2nd glob in the code.. Why?? Any idea on how to fix this? I don’t really understand why I have an error..
printis a function in Python 3. You can’t use it as a statement like you would in the 2.x versions. Your code should work if written as: