0%

Python

Python是著名的“龟叔”Guido van Rossum在1989年圣诞节期间,为了打发无聊的圣诞节而编写的一个编程语言。Python就为我们提供了非常完善的基础代码库,覆盖了网络、文件、GUI、数据库、文本等大量内容,被形象地称作“内置电池(batteries included)”。用Python开发,许多功能不必从零编写,直接使用现成的即可。除了内置的库外,Python还有大量的第三方库,也就是别人开发的,供你直接使用的东西。当然,如果你开发的代码通过很好的封装,也可以作为第三方库给别人使用。

python拥有matplotlib、Numpy、sklearn、keras等大量的库,像pandas、sklearn、matplotlib这些库都是做数据处理、数据分析、数据建模和绘图的库,基本上机器学习中对数据的爬取(scrapy)、对数据的处理和分析(pandas)、对数据的绘图(matplotlib)和对数据的建模(sklearn)在python中全都能找到对应的库来进行处理。

资源

Beginner resources for those just starting with programming and Python

Intermediate resources for those looking to apply the basics of Python knowledge to fields like data science and web development

Advanced resources for those looking to get into concepts like deep learning and big data with Python

Exercises that help practice and cement Python skills in practice

1- Welcome to Python.org

The official Python site offers a good way to get started with the Python ecosystem and to learn Python, including a place to register for upcoming events, and documentation to get started.

2-Learn Python the Hard Way

An online book with a paid and a free version. The free version goes into an outline of the content and can be a useful to-do list.

3-Basic Data Types in Python – Real Python

RealPython dives into the different data types in Python in detail. Learn the difference between floating point and integers, what special characters can be used in Python and more.

4-How to Run Your Python Scripts – Real Python

This simple intro to Python scripts through the command line and text editors will get you up and running for your first Python experiments — a handy tool to get you started as you learn Python.

5-Python Tutorial: Learn Python For Free| Codecademy

Codecademy offers a free interactive course that helps you practice the fundamentals of Python while giving you instant, game-like feedback. A great device for learning Python for those who like to practice their way to expertise.

6-Google’s Python Class | Python Education | Google Developers

The official Python development class from Google’s developers. This tutorial is a mix of interactive code snippets that can be copied and run on your end and contextual text. This is a semi-interactive way to learn Python from one of the world’s leading technology companies.

7-Learn Python – Free Interactive Python Tutorial

This interactive tutorial relies on live code snippets that can be implemented and practiced with. Use this resource as a way to learn interactively with a bit of guidance.

8-Jupyter Notebook: An Introduction – Real Python

Want an easy, intuitive way to access and work with Python functions? Look no further than Jupyter Notebook. It’s much easier to work with than the command line and different cobbled together scripts. It’s the setup I use myself. This tutorial will help you get started on your path to learn Python.

9-Python Tutorial – W3Schools

W3Schools uses the same format they use to teach HTML and others with Python. Practice with interactive and text snippets for different basic functions. Use this tutorial to get a firm grounding in the language and to learn Python.

10-Python | Kaggle

Kaggle is a platform which hosts data science and machine learning competitions. Competitors work with datasets and create as accurate of a predictive model as possible. They also offer interactive Python notebooks that help you learn the basics of Python. Choose the daily delivery option to have it become an email course instead.

11-Learning Python: From Zero to Hero – freeCodeCamp.org

This text-based tutorial aims to summarize all of the basic data and functional concepts in Python. It dives into the versatility of the language by focusing on the object and class portions of the object-oriented part of Python. By the end of it, you should have a neat summary of objects in Python as well as different data types and how to iterate or loop over them.

12-BeginnersGuide – Python Wiki

This simple tutorial on the official Python Wiki is chock-full of resources, and even includes a Chinese translation for non-English speakers looking to learn Python.

13-Python Tutorial – Tutorialspoint

Set up in a similar fashion to W3Schools, use Tutorialspoint as an alternative or a refresher for certain functions and sections.

14-Python (programming language) – Quora

The Quora community is populated with many technologists that learn Python. This section devoted to Python includes running analysis and pressing questions on the state of Python and its practical application in all sorts of different fields, from data visualization to web development.

15-Python – DEV Community – Dev.to

Dev.to has user-submitted articles and tutorials about Python from developers who are working with it every day. Use these perspectives to help you learn Python.

16-Python Weekly: A Free, Weekly Python E-mail Newsletter

If you’re a fan of weekly newsletters that summarize the latest developments, news, and which curate interesting articles about Python, you’ll be in luck with Python Weekly. I’ve been a subscriber for many months, and I’ve always been pleased with the degree of effort and dedication placed towards highlighting exceptional resources.

17-The Ultimate List of Python YouTube Channels – Real Python

For those who like to learn by video, this list of Youtube channels can help you learn in your preferred medium.

18-The Hitchhiker’s Guide to Python

Unlike the rest of the resources listed above, the Hitchhiker’s guide is much more opinionated and fixated on finding the best way to get set up with Python. Use it as a reference and a way to make sure you’re optimally set up to be using and learning Python.

19-Python: Online Courses from Harvard, MIT, Microsoft | edX

edX uses corporate and academic partners to curate content about Python. The content is often free, but you will have to pay for a verified certificate showing that you have passed a course.

20-Python Courses | Coursera

Coursera’s selection of Python courses can help you get access to credentials and courses from university and corporate providers. If you feel like you need some level of certification, similar to edX, Coursera offers a degree of curation and authentication that may suit those needs.

21-Getting started with Django | Django

The official Django framework introduction will help you set up so that you can do web development in Python.

22-LEARNING PATH: Django: Modern Web Development with Django

This resource from O’Reilly helps fashion a more curated path to learning Django and web development skills in Python.

23-A pandas cookbook – Julia Evans

I learned how to clean and process data with the Pandas Cookbook. Working with it enabled me to clean data to the level that I needed in order to do machine learning and more.

It works through an example so you can learn how to filter through, group your data, and perform functions on it — then visualize the data as it needs be. The Pandas library is tailor-built to allow you to clean up data efficiently, and to work to transform it and see trends from an aggregate-level basis (with handy one-line functions such as head() or describe).

The Pandas cookbook is the perfect intro to it.

24-Newest ‘python’ Questions – Stack Overflow

The Stack Overflow community is filled with pressing questions and tangible solutions. Use it a resource for implementation of Python and your path to learn Python.

25-Python – Reddit

The Python subreddit offers a bunch of different news articles and tutorials in Python.

26-Data Science – Reddit

The Data Science subreddit offers tons of resources on how to use Python to work with large datasets and process it in interesting ways.

27-Data science sexiness: Your guide to Python and R

I wrote this guide for The Next Web in order to distinguish between Python and R and their usages in the data science ecosystem. Since then, Python has pushed ever-forward and taken on many of the libraries that once formed the central basis of R’s strength in data analysis, visualization and exploration, while also welcoming in the cornerstone machine learning libraries that are driving the world. Still, it serves as a useful point of comparison and a list of resources for Python as well.

28-Data Science Tutorial: Introduction to Using APIs in Python – Dataquest

One essential skill when it comes to working with data is to access the APIs services like Twitter, Reddit and Facebook use to expose certain amounts of data they hold. This tutorial will help walk you through an example with the Reddit API and help you understand the different code responses you’ll get as you query an API.

29-Introduction to Data Visualization in Python – Towards Data Science

Once you’re done crunching the data, you need to present it to get insights and share them with others. This guide to data visualization summarizes the data visualization options you have in Python including Pandas, Seaborn and a Python implementation of ggplot.

30-Top Python Web Development Frameworks to Learn in 2019

If you want a suite of options beyond Django to develop in Python and learn Python for web applications, look no further than this compilation. The Hacker Noon publication will often feature useful resources on Python outside of this article as well. It’s worth a follow.

31-Beginner’s Guide to Machine Learning with Python

This text-based tutorial helps introduce people to the basics of machine learning with Python. Towards Data Science, the Medium outlet with the article in question, is an excellent source for machine learning and data science resources.

32-Free Machine Learning in Python Course – Springboard

This free learning path from Springboard helps curate what you need to learn and practice machine learning in Python.

33-Machine Learning – Reddit

The Machine Learning subreddit oftentimes focuses on the latest papers and empirical advances. Python implementations of those advances are discussed as well.

34-Python – KDnuggets

KDNuggets offers advanced content on data science, data analysis and machine learning. Its Python section deals with how to implement these ideas in Python.

35-Learn Python – Beginner through Advanced Online Courses – Udemy

Udemy offers a selection of Python courses, with many advanced options to teach you the intricacies of Python. These courses tend to be cheaper than the certified ones, though you’ll want to look carefully at the reviews.

36-A Brief Introduction to PySpark – Towards Data Science

This introduction to PySpark will help you get started with working with more advanced distributed file systems that allow you to deal and work with much larger datasets than is possible under a single system and Pandas.

37-scikit-learn: machine learning in Python

The default way most data scientists use Python is to try out model ideas with scikit-learn: a simple, optimized implementation of different machine learning models. Learn a bit of machine learning theory then implement and practice with the scikit-learn framework.

38-The Next Level of Data Visualization in Python – Towards Data Science

This tutorial walks through more advanced versions of data visualizations and how to implement them, allowing you to take a preview of different advanced ways you can slice your data from correlation heatmaps to scatterplot matricies.

39-Machine Learning with Python | Coursera

Coursera’s selection of courses on machine learning with Python are veryw well-known. This introduction offered with IBM helps to walk you through videos and explanations of machine learning concepts.

40-Home – deeplearning.ai

Deeplearning.ai is Andrew Ng’s (the famous Stanford professor in AI and founder of Coursera) attempt to bring deep learning to the masses. I ended up finishing all of the courses: they offer certification and are a refreshing mix of both interactive notebooks where you can work with the different concepts and videos from Andrew Ng himself.

41-fast.ai · Making neural nets uncool again

This curated course on deep learning helps break down section-by-section aspects of machine learning. Best of all, it’s completely free. I often use fast.ai as a refresher or a deep dive into a deep learning idea I don’t quite understand.

42-Learn and use machine learning | TensorFlow Core | TensorFlow

This tutorial helps you use the high-level Keras component of TensorFlow and Google cloud infrastructure to do deep learning on a set of fashion images. It’s a great way to learn and practice your deep learning skills.

43-Datasets | Kaggle

Kaggle offers a variety of datasets with user examples and upvoting to guide you to the most popular datasets. Use the examples and datasets to create your own data analysis, visualization, or machine learning model.

44-Practice Python

Practice Python has a bunch of beginner exercises that can help you ease into using Python and practicing it. Use this as an initial warmup exercise before you tackle different projects and exercises.

45-Python Exercises – W3Schools

The Python exercises on W3Schools follow the sections in their tutorials, and allow you to get some interactive practice with Python (though the exercises are in practice very simple).

46-Solve Python | HackerRank

HackerRank offers a bunch of exercises that require you to solve without any context. It’s the best way to practice different functions and outputs in Python in isolation (though you’ll still want to do different projects to be able to cement your Python skill.) You’ll earn points and badges as you complete more challenges. This certainly motivates me to learn more. A very useful sandbox for you to learn Python with.

47-Project Euler: About

Project Euler offers a variety of ever-harder programming challenges that aim to test whether you can solve mathematical problems with Python. Use it to practice your mathematical reasoning and your Pythonic abilities.

48-Writing your first Django app, part 1 | Django documentation | Django

This documentation helps you get on the ground with your first Django app, allowing you to use Python to get something up on the web. Once you’ve started with it, you can build anything you want.

49-Top 100 Python Interview Questions & Answers For 2019 | Edureka

Should you ever be in an interview where your Python skills are at question, this list of interview questions will help as a useful reminder and refresher and a good way for you to practice and cement different Python concepts.

50-6 best online courses for ethical hackers

Ethical hackers play an important role in organizations by finding and fixing vulnerabilities in systems and applications. Python is a high-level programming language that’s ideal for security professionals as it’s easy to learn and lets you create functional programs with a limited amount of code.

实例

语法

爬虫:requests、scrapy、selenium、beautifulSoup,这些库都是写网络爬虫需要使用到的,好好掌握这些东西,数据就有了。

数据处理:Numpy、scipy、pandas、matplotlib,这些库分别可以进行矩阵计算、科学计算、数据处理、绘图等操作,有了这些库,你就可以一步步开始把数据处理成你需要的格式。

建模:nltk、keras、sklearn,这些库主要是用于自然语言处理、深度学习和机器学习的,把这些用好了,你的模型就构建出来了。

Web开发:django、flask、tornado,这些库搞明白了,你web开发也就搞定了。

requests

优雅简单的 HTTP 模块。

BeautifulSoup

很好用的 HTML/XML 解析器。

json

JSON 编码解码器。

应用举例:

  • 格式化 JSON 文件

1
python -m json.tool src.json > dst.json

在 Vim 里格式化 JSON:

1
:%!python -m json.tool

CGIHTTPServer

简单实用的 HTTP 服务器。

应用举例:

  • 运行一个简易的 HTTP 服务器

1
python -m CGIHTTPServer 80

base64

方便地进行 base64 编解码的模块。

应用举例:

  • 解码 base64

1
echo aGVsbG93b3JsZA== | python -m base64 -d

则能看到输出

1
helloworld

Buy Me A Coffee
Title - Artist
0:00