EvilZone

Programming and Scripting => Beginner's Corner => : Cranoo February 07, 2015, 10:44:02 PM

: Python Syntax problems.
: Cranoo February 07, 2015, 10:44:02 PM
I'm back to Python after about two years (had too much to do) and now I can't get my old scripts to run because of syntax errors.

Is there any decent Python3 tutorials out there? I've checked google but I couldn't find a decent one.

Thanks in advance. I'm fairly new to Python too.
: Re: Python Syntax problems.
: Phage February 07, 2015, 10:53:56 PM
Honestly, if you already know how to program, the offical docs should be enough.

Anyway, I'll leave two links:
: Re: Python Syntax problems.
: Cranoo February 07, 2015, 10:56:19 PM
Thanks mate, like I meant all my scripts written in 2 won't run in Py3. I've first messed around with Py3 tonight and there's alot of syntax change, am I going to have to rewrite everything? Know what I mean? That's for the tutorials.

Edit: Should I just stick with Py2 for now?
: Re: Python Syntax problems.
: Pavornoc February 08, 2015, 08:49:32 AM
Hey Cranoo,

Yeah, the syntax changed a bit (i.e raw_input() just became input() ), but something to consider is do you really need to use 3 over 2?

Don't get me wrong, I'm not saying don't learn it; I used python 3 to create a script to sort through IP subnets at work because of the handy IP modules 3 has.  However, python 2 comes installed on a lot of systems currently, like Macs and most Linux distros, whereas anything needing 3 you would need to install 3 specifically.  If you're trying to execute a python script on a remote system, you may want to just do it in 2.  There's also a tool called py2exe that can create .exe files for Windows off of python 2 scripts, but it doesn't work on python 3 (last time I checked the project).

But if this is just for your own scripts/education, I would say check out what Phage suggested and the official docs. There's more support out there for 2 right now so you'll probably need to do things the hard way for 3 for now.

Good luck!