search
HomeBackend DevelopmentPython TutorialPython3零基础自学方法?

我是一名普通的初中生毕业,现在在钢厂工作。在知乎上看到知道创宇的很多大牛。所以我觉得我应该也要跟他们一样。所以现在想利用业余时间学习编程,不知道先学Python是否合适,但是看到大家都赞同的一句“搞就牛”。所以想先学会Python,再跟大牛们一起学习,讨论。但是发现Python有2.X和3.X版本之分。搜到很多学习资料都是2.X版本的。我想问问各位大牛,针对这样的情况,有没有好的建议,或者学习资料推荐。

回复内容:

@Fooying 说得不错,但有一些细节我需要补充一下:
  1. Python 3.x并不是完全不兼容2.x的代码,只要遵循一定的规范、利用诸如six之类的package,程序员完全可以开发2/3 compatible的程序。另外,官方还推出了一个2to3的tool帮助代码迁移,民间也弄了一个3to2的tool。如果想要编写2/3 compatible的程序,这里有一个比较好的check list:Porting code to Python 3 with 2to3
  2. 不建议入手《Python核心编程》的第二版,原因与人渣宋吉广相关,详情请自行Google。

从开发的角度来说,Python3填掉了2中的一些坑,对于普通用户来说最主要的区别就是(Strings, Unicode)变成了(Strings, Bytes)、广泛使用iterator等,其次就是引入、扩展了一些高级机制,如metaclass、parameter annotation、“started” target等。从易用性的角度来说Python3完爆2(至少我是这么认为的),不过很可惜的是,目前一些关键的package还没有来得及port到3上来,同时很多公司的项目考虑到成本因素也没有及时将原本Py2的代码port到3上。


更多请参考我Blog中的一篇文章:Python学习指引


PS1:为什么没人提钢厂非法雇佣童工的问题?

PS2:题主请重视英文、数学与算法的学习。

自己做了一个自学python的小组,欢迎到弊站交流心得~
30天尝试新事情

网络上很多你需要重复去做的,都可以写python脚本去做。
比如知乎的一些好文章,你要保存下来,或者自动定期发送到kindle电子书
python爬虫 推送知乎文章到kindle电子书
github: GitHub - Rockyzsu/zhihuToKindle
Python3零基础自学方法?
python 暴力破解wordpress博客后台登陆密码
Python3零基础自学方法?


批量获取色影无忌图片 Python_小组(链接修复中)
(链接修复中)
用python破解某211大学BBS论坛用户密码(链接修复中)
感觉都是自己为了完成某种目的而且做得,这样动机会更加明确。 目前准备爬取股票信息,做研究使用(炒股啦)
更多 30天尝试新事情 谢谢邀请。
首先先赞赏下楼主的Python都是P大写开头的
其次说一点,Python 3.x不能向下兼容2.x
这点意味着你拿别人用Python 2.x写的代码在3.x的环境下是不能直接运行的,需要改动
现在很多网上很多的代码与文档中的Python代码一般都是2.x,一般都会采用Python 2.7(很多用Python的公司,也是继续用着Python 2.7,而不是3.x)
如果楼主想学3.0,建议先了解清楚两个迭代版本的区别,再进行学习
然后一般在学习Python的时候我会推荐一本书《Python核心编程》,现在似乎有第三版了,不过没中文版的,中文版最新版是第二版,第三版不清楚,第二版是Python 2.x的,但基础语法那些肯定是基本相同的,就不用说,在你了解两个大版本区别后,同样是学习资料
然后我们公司在面试的时候一般会要求面试者做两道题:
1、写一个爬虫(用线程池等)
2、写个论坛程序
别乍一看觉得挺简单的,怎么写好一个爬虫是有很多讲究的;然后写论坛程序,可以学习Python的Web框架,如web.py Django等
另外,只有一点,边学边码,实践才是大道理,在计算机的世界,说的再多,不去做,都是扯淡。。。 其实也没多少不同,也就是 print 要加括号,input 不用 raw,map filter 默认是迭代器而不是列表,import 机制也有变化比如说相对引用的 . ,不用考虑编码等等。

3 里面改掉 2 里面很多莫名其妙的地方,值得去学,因为 2 里面有很多向上兼容,说以 3->2 比 2->3 容易。

初中毕业学 Python 没问题。自学的话可以看看 Dive into Python 3 深入 Python 3,不过还是要学会查英文资料,中文 Python 资料还不算很全。
好吧,有人反对 为什么《Dive into Python》不值得推荐 ,不过我就是看这个的(不过不是零基础),Python 简明手册也不错。
实际上最好看官方文档,只是翻译不全: Overview — Python 3 文档(简体中文) 3.2.2 documentation 嗯,最重要的是利用 Python 中的 Help 函数。有什么函数不会,直接 help(函数名不加括号) 就好(不过是英文)。

Python 不是一门要你去拿个资料学学学学完了就好了,你用着用着就是在学,最好不要为学Python 而学,有一个目标,比如说做游戏,网站或者某个工具(爬虫),边做边学不用怕。

而且最重要的是,我看问题描述你的目的不是学 Python,而是学编程,你可以在略懂 Python 以后去多看看各种语言,看看编程的各种方法,怎么抽象怎么复用,Python 的面向对象和别的语言的面向对象,乃至函数式编程。放心不难的,只要你在编程中找到乐趣喜欢编程而不是单纯的为工作什么的而编程。 无他,撸码三万行,不会大法也不行,来,跟我走,拯救世界的责任就交给你了 网上有很多python 3的资料,不管做什么,善用Google是第一步。
干脆直接发地址出来。
Python 3 入门教程:liam0205.me/attachment/ 看书吧,Pyhthon3自学书籍(13-15年的书,之前的就不要看了):
  1. 入门:Introducing Python(英文版2014.4.8出版)此书中文翻译版:Python语言及其应用(中文版2016.01出版,可以预定到,两周前已拿到手)。 此外入门还推荐廖雪峰老师的网站:Python教程(2.x和3.x的两个版本都有)网址为:liaoxuefeng.com
  2. 进阶:Learning Python, 5th Edition(英文版2013.6出版) 此书中文翻译只有第四版的,有一些区别,但对应着看,差不多:Python学习手册 第四版(中文版2011年4月出版)
  3. 高级技巧磨练:Python Cookbook,3rd Edition (英文版2013.5出版)此书中文翻译版:Python Cookbook(第三版)中文版(中文版 2015年5月1日出版)
去找个2.x与3区别总结 一类的文章,然后就开始学习…另外不要在这类问题上止步不前,关键在于开始做 能有爱好。在谋生的过程中慢慢积累这自己的理想。勿忘初衷,不断学习积累。
像1楼大牛的答案就说得很好。算是明确了个方向。入门先从应用面广的2.X开始,基础打好了,以后掌握其他的也容易很多。
现在网络方便,确实给自学提供了很大的便利。但也容易让人淹没在咨询的汪洋中。选好种入手的方式,开始学习才最重要。
也不知道题主现在进展如何。这几年国外再推广编程语言从小学起的活动,不少入门级的网站可以边玩边学。
学的差不多,就要边实践边摸索,这是编程学习的不二法则。可以做做网站,做做程序实现些功能,不管有没有意义。
另外:Instagram,豆瓣,42qu,知乎就是用Python做的。 学好英文
利用好网易公开课
多练习,最好是实践
比如可以看看这里Codecademy
不耻下问
——————
当然,还要说一句,你是初中学历?不确定你的基础知识底子如何,最好业余把高中知识学一遍
也可以考虑看看 达内科技,是个培训学校

祝你成功!
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Python vs. C  : Understanding the Key DifferencesPython vs. C : Understanding the Key DifferencesApr 21, 2025 am 12:18 AM

Python and C each have their own advantages, and the choice should be based on project requirements. 1) Python is suitable for rapid development and data processing due to its concise syntax and dynamic typing. 2)C is suitable for high performance and system programming due to its static typing and manual memory management.

Python vs. C  : Which Language to Choose for Your Project?Python vs. C : Which Language to Choose for Your Project?Apr 21, 2025 am 12:17 AM

Choosing Python or C depends on project requirements: 1) If you need rapid development, data processing and prototype design, choose Python; 2) If you need high performance, low latency and close hardware control, choose C.

Reaching Your Python Goals: The Power of 2 Hours DailyReaching Your Python Goals: The Power of 2 Hours DailyApr 20, 2025 am 12:21 AM

By investing 2 hours of Python learning every day, you can effectively improve your programming skills. 1. Learn new knowledge: read documents or watch tutorials. 2. Practice: Write code and complete exercises. 3. Review: Consolidate the content you have learned. 4. Project practice: Apply what you have learned in actual projects. Such a structured learning plan can help you systematically master Python and achieve career goals.

Maximizing 2 Hours: Effective Python Learning StrategiesMaximizing 2 Hours: Effective Python Learning StrategiesApr 20, 2025 am 12:20 AM

Methods to learn Python efficiently within two hours include: 1. Review the basic knowledge and ensure that you are familiar with Python installation and basic syntax; 2. Understand the core concepts of Python, such as variables, lists, functions, etc.; 3. Master basic and advanced usage by using examples; 4. Learn common errors and debugging techniques; 5. Apply performance optimization and best practices, such as using list comprehensions and following the PEP8 style guide.

Choosing Between Python and C  : The Right Language for YouChoosing Between Python and C : The Right Language for YouApr 20, 2025 am 12:20 AM

Python is suitable for beginners and data science, and C is suitable for system programming and game development. 1. Python is simple and easy to use, suitable for data science and web development. 2.C provides high performance and control, suitable for game development and system programming. The choice should be based on project needs and personal interests.

Python vs. C  : A Comparative Analysis of Programming LanguagesPython vs. C : A Comparative Analysis of Programming LanguagesApr 20, 2025 am 12:14 AM

Python is more suitable for data science and rapid development, while C is more suitable for high performance and system programming. 1. Python syntax is concise and easy to learn, suitable for data processing and scientific computing. 2.C has complex syntax but excellent performance and is often used in game development and system programming.

2 Hours a Day: The Potential of Python Learning2 Hours a Day: The Potential of Python LearningApr 20, 2025 am 12:14 AM

It is feasible to invest two hours a day to learn Python. 1. Learn new knowledge: Learn new concepts in one hour, such as lists and dictionaries. 2. Practice and exercises: Use one hour to perform programming exercises, such as writing small programs. Through reasonable planning and perseverance, you can master the core concepts of Python in a short time.

Python vs. C  : Learning Curves and Ease of UsePython vs. C : Learning Curves and Ease of UseApr 19, 2025 am 12:20 AM

Python is easier to learn and use, while C is more powerful but complex. 1. Python syntax is concise and suitable for beginners. Dynamic typing and automatic memory management make it easy to use, but may cause runtime errors. 2.C provides low-level control and advanced features, suitable for high-performance applications, but has a high learning threshold and requires manual memory and type safety management.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software