I am a beginner of python, and here's a problem concerns me all the time. For example, a really simple code:
a = int (input (' please a number '))
if a <0:
a = 0
print ('change to zero')
elif a == 0:
print ('zero')
elif a == 1:
print ('one')
else:
print ('more')
This code runs well in terminal when I type in python testif.py (the file name). But when I try to type ./testif.py It shows:
-bash: ./testif.py: Permission denied
This also happen in ubuntu, I tried to add
#!/usr/bin/python
at the first line, it still doesn't work
So please help me with my problem, struggle me all the time.
chmod +x testif.py)chmod +x testif.py-- note: you only need to do it once per script) then run it aspython testif.pyorpython -mtestifif testif.py's directory is insys.path(the current directory is).