Convert Figma logo to code with AI

xianhu logoLearnPython

以撸代码的形式学习Python

8,074
4,027
8,074
14

Top Related Projects

Sample code for Channel 9 Python for Beginners course

30 days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than100 days, follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw

Python - 100天从新手到大师

199,949

All Algorithms implemented in Python

An opinionated list of awesome Python frameworks, libraries, software and resources.

📚 Playground and cheatsheet for learning Python. Collection of Python scripts that are split by topics and contain code examples with explanations.

Quick Overview

LearnPython is a comprehensive GitHub repository designed to help users learn Python programming. It contains a wide range of Python code examples, tutorials, and resources covering various aspects of the language, from basic syntax to advanced topics like web scraping and data analysis.

Pros

  • Extensive collection of Python examples and tutorials
  • Covers a broad range of topics, suitable for beginners to advanced users
  • Well-organized structure with clear categorization of topics
  • Regularly updated with new content and improvements

Cons

  • Some examples may lack detailed explanations
  • Not a structured course, which might be challenging for complete beginners
  • Some advanced topics may require additional resources for in-depth understanding
  • Primarily in Chinese, which may be a barrier for non-Chinese speakers

Code Examples

Here are a few code examples from the repository:

  1. Basic string manipulation:
# String reversal
text = "Hello, World!"
reversed_text = text[::-1]
print(reversed_text)
  1. List comprehension:
# Generate a list of squares for numbers 1 to 10
squares = [x**2 for x in range(1, 11)]
print(squares)
  1. Simple web scraping using requests and BeautifulSoup:
import requests
from bs4 import BeautifulSoup

url = "https://example.com"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
title = soup.title.string
print(f"Page title: {title}")

Getting Started

To get started with LearnPython:

  1. Clone the repository:

    git clone https://github.com/xianhu/LearnPython.git
    
  2. Navigate to the cloned directory:

    cd LearnPython
    
  3. Explore the various folders and Python files to find topics of interest.

  4. Open the Python files in your preferred text editor or IDE to study the code examples and explanations.

  5. Run the Python scripts to see the results and experiment with modifications to enhance your learning.

Competitor Comparisons

Sample code for Channel 9 Python for Beginners course

Pros of c9-python-getting-started

  • More structured and comprehensive curriculum for beginners
  • Includes interactive Jupyter notebooks for hands-on learning
  • Backed by Microsoft, potentially offering more reliable and up-to-date content

Cons of c9-python-getting-started

  • Less extensive coverage of advanced Python topics
  • Fewer code examples and practical projects compared to LearnPython
  • More focused on Cloud9 environment, which may not be relevant for all learners

Code Comparison

LearnPython example (basic file operations):

with open("file.txt", "w") as f:
    f.write("Hello, World!")

with open("file.txt", "r") as f:
    content = f.read()
    print(content)

c9-python-getting-started example (using Azure Cognitive Services):

from azure.cognitiveservices.vision.computervision import ComputerVisionClient
from msrest.authentication import CognitiveServicesCredentials

client = ComputerVisionClient(endpoint, CognitiveServicesCredentials(subscription_key))
image_analysis = client.analyze_image_in_stream(image)

The code comparison shows that LearnPython focuses on fundamental Python concepts, while c9-python-getting-started includes more advanced topics related to cloud services and AI.

30 days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than100 days, follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw

Pros of 30-Days-Of-Python

  • Structured daily learning approach with clear progression
  • More comprehensive coverage of Python concepts and libraries
  • Includes practical projects and exercises for hands-on learning

Cons of 30-Days-Of-Python

  • May be overwhelming for absolute beginners due to its pace
  • Less focus on advanced topics and real-world applications
  • Larger repository size, which may be harder to navigate

Code Comparison

LearnPython example (basic syntax):

print("Hello, World!")
name = input("What's your name? ")
print(f"Nice to meet you, {name}!")

30-Days-Of-Python example (more advanced concept):

def calculate_mean(numbers):
    return sum(numbers) / len(numbers)

data = [1, 2, 3, 4, 5]
mean = calculate_mean(data)
print(f"The mean is: {mean}")

Both repositories offer valuable resources for learning Python, but they cater to different learning styles and experience levels. LearnPython provides a more concise and focused approach, while 30-Days-Of-Python offers a more comprehensive and structured learning path. Choose the one that best fits your learning preferences and goals.

Python - 100天从新手到大师

Pros of Python-100-Days

  • More comprehensive coverage of Python topics, spanning 100 days of learning
  • Includes practical projects and exercises for hands-on experience
  • Structured curriculum with clear progression from basics to advanced topics

Cons of Python-100-Days

  • May be overwhelming for absolute beginners due to its extensive content
  • Less focus on specific Python libraries and frameworks compared to LearnPython

Code Comparison

Python-100-Days example (Day 7 - String manipulation):

s1 = 'hello ' * 3
print(s1)  # hello hello hello 
s2 = 'world'
s1 += s2
print(s1)  # hello hello hello world

LearnPython example (String manipulation):

str1 = "Hello"
str2 = "World"
print(str1 + " " + str2)  # Hello World
print(str1 * 3)  # HelloHelloHello

Both repositories provide examples of string concatenation and repetition, but Python-100-Days offers a more structured approach with daily lessons, while LearnPython focuses on concise examples for quick reference.

199,949

All Algorithms implemented in Python

Pros of Python

  • More comprehensive coverage of algorithms and data structures
  • Active community with frequent updates and contributions
  • Well-organized directory structure for easy navigation

Cons of Python

  • May be overwhelming for beginners due to its extensive content
  • Lacks explanatory content or tutorials for each algorithm
  • Primarily focuses on implementation, with less emphasis on theory

Code Comparison

LearnPython:

def binary_search(arr, x):
    low = 0
    high = len(arr) - 1
    while low <= high:
        mid = (low + high) // 2
        if arr[mid] < x:
            low = mid + 1
        elif arr[mid] > x:
            high = mid - 1
        else:
            return mid
    return -1

Python:

def binary_search(array, element, left, right):
    if left > right:
        return -1
    middle = (left + right) // 2
    if element == array[middle]:
        return middle
    elif element < array[middle]:
        return binary_search(array, element, left, middle - 1)
    else:
        return binary_search(array, element, middle + 1, right)

The Python implementation uses recursion, while LearnPython uses iteration. Python's version may be more concise but could lead to stack overflow for large arrays. LearnPython's approach is more memory-efficient for large datasets.

An opinionated list of awesome Python frameworks, libraries, software and resources.

Pros of awesome-python

  • Comprehensive curated list of Python frameworks, libraries, and resources
  • Well-organized into categories, making it easy to find specific tools
  • Regularly updated with new and popular Python projects

Cons of awesome-python

  • Lacks detailed explanations or tutorials for using the listed resources
  • May be overwhelming for beginners due to the sheer number of options

Code comparison

LearnPython provides code examples for learning Python concepts:

# Example from LearnPython
def fibonacci(n):
    a, b = 0, 1
    for _ in range(n):
        yield a
        a, b = b, a + b

awesome-python doesn't include code examples, as it's primarily a curated list of resources:

## Web Frameworks

*Full stack web frameworks.*

* [Django](https://www.djangoproject.com/) - The most popular web framework in Python.
* [Flask](https://flask.palletsprojects.com/) - A lightweight WSGI web application framework.

LearnPython focuses on teaching Python through code examples and explanations, while awesome-python serves as a comprehensive directory of Python tools and libraries. LearnPython is more suitable for beginners looking to learn Python, whereas awesome-python is an excellent resource for developers seeking specific tools or exploring the Python ecosystem.

📚 Playground and cheatsheet for learning Python. Collection of Python scripts that are split by topics and contain code examples with explanations.

Pros of learn-python

  • More comprehensive coverage of Python topics, including advanced concepts
  • Well-structured with clear explanations and examples for each topic
  • Includes practical exercises and coding challenges to reinforce learning

Cons of learn-python

  • Less focus on real-world applications and projects
  • May be overwhelming for absolute beginners due to its extensive content

Code Comparison

LearnPython example (basic list comprehension):

squares = [x**2 for x in range(10)]
print(squares)

learn-python example (more advanced list comprehension):

matrix = [
    [1, 2, 3, 4],
    [5, 6, 7, 8],
    [9, 10, 11, 12],
]
flattened = [num for row in matrix for num in row]
print(flattened)

The learn-python repository provides more in-depth examples and explanations, covering a wider range of Python concepts. While LearnPython offers a simpler approach, it may be more suitable for beginners looking for a quick introduction to Python basics.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

LearnPython

以撸代码的形式学习Python, 具体说明在知乎专栏-撸代码,学知识

===================================================================================================

python_base.py: 千行代码入门Python

python_visual.py: 15张图入门Matplotlib

python_visual_animation.py: 使用Matplotlib画动态图实例

python_spider.py: 一个很“水”的Python爬虫入门代码文件

python_weibo.py: “史上最详细”的Python模拟登录新浪微博流程

python_lda.py: 玩点高级的--带你入门Topic模型LDA(小改进+附源码)

python_sqlalchemy.py: 作为一个Pythoner, 不会SQLAlchemy都不好意思跟同行打招呼!

python_oneline.py: 几个小例子告诉你, 一行Python代码能干哪些事

python_requests.py: Python中最好用的爬虫库Requests代码实例

python_functional.py: Python进阶: 函数式编程实例(附代码)

python_decorator.py: Python进阶: 通过实例详解装饰器(附代码)

python_datetime.py: 你真的了解Python中的日期时间处理吗?

python_metaclass.py: Python进阶: 一步步理解Python中的元类metaclass

python_coroutine.py: Python进阶: 理解Python中的异步IO和协程(Coroutine), 并应用在爬虫中

python_aiohttp.py: Python中最好用的异步爬虫库Aiohttp代码实例

python_thread_multiprocess.py: Python进阶: 聊聊IO密集型任务、计算密集型任务,以及多线程、多进程

python_version36.py: Python3.6正式版要来了, 你期待哪些新特性?

python_magic_methods: Python进阶: 实例讲解Python中的魔法函数(Magic Methods)

python_restful_api.py: 利用Python和Flask快速开发RESTful API

python_restful_api.py: RESTful API进阶: 连接数据库、添加参数、Token认证、返回代码说明等

python_context.py: With语句和上下文管理器ContextManager

python_flask.py: Flask相关说明

MyShow: 玩点好玩的--知乎全部话题关系可视化

python_markov_chain.py: 玩点好玩的--使用马尔可夫模型自动生成文章

python_wechat.py: 玩点好玩的--自己写一个微信小助手

python_csv.py: Python中CSV文件的简单读写

python_numpy.py: 使用numpy进行矩阵操作

python_mail.py: 使用Python自动发送邮件,包括发送HTML以及图片、附件等

python_redis.py: Python操作Redis实现消息的发布与订阅

python_schedule.py: Python进行调度开发

python_socket.py: Python的socket开发实例

python_re.py:Python的re模块的主要功能以及如何使用它们进行字符串匹配和替换

Plotly目录: 一些plotly画图的实例,使用jupyter notebook编写

===================================================================================================

您可以fork该项目, 并在修改后提交Pull request, 看到后会尽量进行代码合并