Python Basics part -1 - Hello world
Loading...
2,567
Loading...
Uploader Comments (metalx1000)
see all
All Comments (9)
-
@tontoF12 I disagree zsh rules, zsh can be used as an irc client :P
-
@cqcboy100 also im new to vim so im trying to follow your commands so im not sure if i save it or not
-
Thanks man!
Python % bash rulz! ;)
Loading...
hey, im having trouble trying to run the python script and the part were i get stuck at is after using vim and closing it i do chmod +x mypython.py but it goes to the next line and does nothing? got ideas?
cqcboy100 1 year ago
@cqcboy100: That command shouldn't have and output if it runs properly. It just changes the permissions of your script to make is executable. After you do that, and you only have to do it once, then you would run your script like this:
./mypython.py
the is a dot slash sriptname
metalx1000 1 year ago
so if the "#" sign is used for commenting, why do you put "!/usr/bin/python" behind a "#"??
isn't it supposed to ignore that line??
elnegrobembon 1 year ago
@elnegrobembon: The first line of any script in a Unix like environment (Linux, Mac OS, etc...) tells the system what type of script it is. So, in a way it is a comment. That line is not run and not really part of the code. You could leave it out and the script will work fine, just instead of running the script like this:
./script.py
you would have to run it like this:
python script.py
It's just more proper to have it.
metalx1000 1 year ago
@metalx1000
ahhh i see.. so it ignores everything behind the # except for in the first line where you set the environment??
and it's basically just saying to run that script using python program right?
i think i got it...
i appreciate the response man... youre a good teacher too.. thanx a lot for these vids.
elnegrobembon 1 year ago
@elnegrobembon: Right, if you where righting a BASH script, the first line would be:
#!/bin/bash
If it was a perl script it would be:
#!/usr/bin/perl
Basically telling the system where the interpreter is.
This line is called the "Shebang"
metalx1000 1 year ago