Flask example with POST

Before actually answering your question: Parameters in a URL (e.g. key=listOfUsers/user1) are GET parameters and you shouldn’t be using them for POST requests. A quick explanation of the difference between GET and POST can be found here. In your case, to make use of REST principles, you should probably have: Then, on each URL, you can define the behaviour of different … Read more

How to unnest a nested list

Use itertools.chain: itertools.chain(*iterables): Make an iterator that returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterables are exhausted. Used for treating consecutive sequences as a single sequence. Example: The output is:

Python Weather API

Since Google has shut down its weather API, I suggest to check out OpenWeatherMap: The OpenWeatherMap service provides free weather data and forecast API suitable for any cartographic services like web and smartphones applications. Ideology is inspired by OpenStreetMap and Wikipedia that make information free and available for everybody. OpenWeatherMap provides wide range of weather data … Read more

Difference between scikit-learn and sklearn

You might need to reinstall numpy. It doesn’t seem to have installed correctly. sklearn is how you type the scikit-learn name in python. Also, try running the standard tests in scikit-learn and check the output. You will have detailed error information there. Do you have nosetests installed? Try: nosetests -v sklearn. You type this in bash, not in the … Read more

Using BeautifulSoup to search HTML for string

The following line is looking for the exact NavigableString ‘Python’: Note that the following NavigableString is found: Note this behaviour: So your regexp is looking for an occurrence of ‘Python’ not the exact match to the NavigableString ‘Python’.