background preloader

Python

Facebook Twitter

How To Make A Simple Python Keylogger. Free Online IDE and Terminal. Www.catonmat. One of the upcoming projects I am doing (I will reveal it in one of the next blog posts.) is going to be written entirely in Python. I have a good understanding of Python but, same as I had with JavaScript, I have little experience doing projects from the ground up in it. Update: the project was redditriver.com, read designing redditriver.com (includes full source code). Before diving into the project I decided to take a look at a few Python video lectures to learn language idioms and features which I might have not heard of.

Finding Python video lectures was pretty easy as I run a free video lecture blog. First Python Lecture: Python for Programmers Interesting moments in the lecture: [07:15] There are several Python implementations - CPython, PyPy, IronPython and Jython. Okay, this talk was a very basic talk and it really was an introduction for someone who never worked in Python.

Second Python Lecture: Advanced Python or Understanding Python Question and answer session: PS. 2. Built-in Functions. Open a file, returning an object of the file type described in section File Objects. If the file cannot be opened, IOError is raised. When opening a file, it’s preferable to use open() instead of invoking the file constructor directly. The first two arguments are the same as for stdio‘s fopen(): name is the file name to be opened, and mode is a string indicating how the file is to be opened. The most commonly-used values of mode are 'r' for reading, 'w' for writing (truncating the file if it already exists), and 'a' for appending (which on some Unix systems means that all writes append to the end of the file regardless of the current seek position). If mode is omitted, it defaults to 'r'.

The optional buffering argument specifies the file’s desired buffer size: 0 means unbuffered, 1 means line buffered, any other positive value means use a buffer of (approximately) that size (in bytes). In addition to the standard fopen() values mode may be 'U' or 'rU'. MIT - A Gentle Introduction to Python. Python Web Development: Understanding Django for Beginners. Learn Python The Hard Way. This exercise has no code. It is simply the exercise you complete to get your computer to run Python. You should follow these instructions as exactly as possible.

For example, Mac OS X computers already have Python 2, so do not install Python 3 (or any Python). Go to with your browser, get the Notepad++ text editor, and install it. From now on, when I say "Terminal" or "shell" I mean PowerShell and that's what you should use. Warning Sometimes you install Python on Windows and it doesn't configure the path correctly. > python ActivePython 2.6.5.12 (ActiveState Software Inc.) based on Python 2.6.5 (r265:79063, Mar 20 2010, 14:22:52) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

>>> quit()> mkdir mystuff > cd mystuff ... It is still correct if you see different information than mine, but yours should be similar. A major part of this book is learning to research programming topics online. How to Build a Crawler in Python. Short Bytes: Web crawler is a program that browses the Internet (World Wide Web) in a predetermined, configurable and automated manner and performs given action on crawled content. Search engines like Google and Yahoo use spidering as a means of providing up-to-date data. Webhose.io, a company which provides direct access to live data from hundreds of thousands of forums, news and blogs, on Aug 12, 2015, posted the articles describing a tiny, multi-threaded web crawler written in python. This python web crawler is capable of crawling the entire web for you. Ran Geva, the author of this tiny python web crawler says that: I wrote as “Dirty”, “Iffy”, “Bad”, “Not very good”.

I say, it gets the job done and downloads thousands of pages from multiple pages in a matter of hours. The python based multi-threaded crawler is pretty simple and very fast. Save the above code with some name lets say “myPythonCrawler.py” . $ python myPythonCrawler.py. Cheatsheet - Python & R codes for common Machine Learning Algorithms. In his famous book – Think and Grow Rich, Napolean Hill narrates story of Darby, who after digging for a gold vein for a few years walks away from it when he was three feet away from it! Now, I don’t know whether the story is true or false.

But, I surely know of a few Data Darby around me. These people understand the purpose of machine learning, its execution and use just a set 2 – 3 algorithms on whatever problem they are working on. They don’t update themselves with better algorithms or techniques, because they are too tough or they are time consuming. Like Darby, they are surely missing from a lot of action after reaching this close! In the end, they give up on machine learning by saying it is very computation heavy or it is very difficult or I can’t improve my models above a threshold – what’s the point?

Today’s cheat sheet aims to change a few Data Darby’s to machine learning advocates. For the super lazy Data Darbies, we will make your life even easier. Related December 28, 2015.