I recently started to learn how to program and am looking to hire a Python developer. How can I separate good code from not so good code?
Read the code. If the code is readable and makes sense to you as a novice, that's a good sign. Good code should be clean and clearly written, with good organization, appropriate use of white space, meaningful names for variables and functions, and comments as necessary.
Run the code. Does it do what it's supposed to do? Another good sign.
Ask the author to explain the code to you. This is perhaps more a test of the author than the code, but it's the author that you're hiring, not the code. If the author can describe the code to a novice like you in a way that makes sense then they surely have a solid understanding of it themselves, and that's yet another good sign. You can also ask the author to critique the code for you -- what if anything would they change, what do they like best, etc.
Finally, ask someone with more experience to review the code. There are a lot of red flags that you can see as a novice, but there are likely to be others that you'll miss completely.
I'm going to assume that you're hiring someone to work on a project for you individually and not as part of a larger company. If you looking to hire someone as part of a larger company on existing projects, try asking for help from within (HR, other developers, etc).
First, if you want to hire someone to help you build/maintain an application, ask about projects they've worked on previously. How did the project end up? Do applications from it still exist? Does the code still work? If someone is actively using a particular language and has worked on successful projects, that's evidence (but not proof) that they are a good coder and produce code of good quality. It's somewhat weak evidence but there it is.
Also, if the applications still exist, try using them. Do they appear to work well? Is there evidence they've been well designed? Tested? Are they awkward or have an awful UI? If an application functions well and "feels" good as an end user, that's more evidence the coder produces good quality code. If the application feels thrown together or very poorly thought out, that's evidence of lower quality code.
Lastly, find (probably Open Source) applications that you think are good applications and read some of the source code. Look for unit tests, coding style and overall structure. The more code you read, the more you'll be able to identify "good" and "bad" code. You can also practice writing code and read up on language features and idioms to get more a feel for particular languages (Python, like many languages, has particular quirks and idioms, broadly captured in the The Zen of Python)
Gross generalization alert!
The two main factors you'd want to watch for in pretty much any language are:
There might be more, but this is as general as it gets, IMHO.