This post contains an example of a lexical scanner which doesn't need third-party libraries. It may not do all you want, but you should be able to use it as a basis for something that fits your needs.
I don't know if your applications all relate to lexical scanning - but if not, ply is a fairly easy to use parser (given that you need to know broadly how parsers work).