`
newand
  • 浏览: 38037 次
  • 性别: Icon_minigender_1
  • 来自: nj
最近访客 更多访客>>
社区版块
存档分类
最新评论

学习python(dive into python chapter 5 )

阅读更多

1. java的类的继承用extends,而python只需在类的后面加上"(父类)",而且可以继承多个父类。

 

2. 当自己创建类方法的时候,第一个参数必须是self,包括init;

当调用父类的方法的时候,必须用self参数,而从自己类的外部,调用类的方法的时候则不必加上self.

 

3. init方法是可选的,但是一旦定义了,就必须要显式的调用父类的init方法

 

4.str[:]的方式截取字符串

 

5.连接字符串的方式,如字符串str1,str2

 

方式1:''.join([str1,str2])

方式2:'%s%s'%(str1,str2) 

方式3:str1+str2

 

6.模块的路径问题,涉及到路径的时候最好用"\\"而不是"\",

不然某些路径如"\a\b"会被当成转义符来处理

0
0
分享到:
评论
1 楼 newand 2008-03-10  
复习chapter 5(dive into python)
1.import module
  from module import fuction
2. a. 定义一个类
   class ClaName(ParCla1,ParCla2)#继承只要在括号里写就可以了
   b. 使用一个类
   ClaName
3. __init__和self
   __init__若要在子类里写,则必须要先调用父类的__init__;
   类里面定义函数的时候,第一个参数必须是self,但是在类的外部调用对应函数的时候则不需要。
4. 私有函数通常是__加在函数名前面(__pass),若在后面再加__,那么就是专有函数的名称(__getitem__)。
5.一般专有函数是在特殊的情况下由python为我们调用,不需要我们自己在代码中显示的调用。

相关推荐

    Dive Into Python 3, r870 (2010).pdf

    Didyoureadtheoriginal“DiveIntoPython”?Didyoubuyit onpaper?(Ifso,thanks!)AreyoureadytotaketheplungeintoPython3?…Ifso,readon.(Ifnoneofthat istrue,you’dbebetteroffstartingatthebeginning.) Python3...

    Dive Into Python PDF与HTML版本

    As in the original book, Dive Into Python, each chapter starts with a real, complete code sample, proceeds to pick it apart and explain the pieces, and then puts it all back together in a summary at ...

    diveintopythonzh-cn-pdf 附代码.rar

    Dive Into Python ................................................................................................................. 1 Chapter 1. 安装 Python ...............................................

    Machine.Learning.in.Python

    The chapters on penalized linear regression and ensemble methods dive deep into each of the algorithms, and you can use the sample code in the book to develop your own data analysis solutions. ...

    Building.RESTful.Python.Web.Services.epub

    We will dive deep into each of these frameworks to build various web services, and will provide use cases and best practices on when to use a particular framework to get the best results. We will ...

    python.rar

    这本书,"Dive Into Python"的中文版,由Mark Pilgrim撰写,是一本广泛认可的Python自学教材。它以清晰易懂的方式介绍了Python的核心概念,帮助读者快速上手并深入理解这门强大的语言。 首先,书中的"Chapter 1: ...

    Building Chatbots with Python(2019)

    You will then dive straight into natural language processing with the natural language toolkit (NLTK) for building a custom language processing platform for your chatbot. With this foundation, you ...

    Python Text Processing with NLTK 2.0 Cookbook.pdf

    This book cuts short the preamble and lets you dive right into the science of text processing with a practical hands-on approach. Get started off with learning tokenization of text. Receive an ...

    Building Chatbots with Python: Using Natural Language Processing and Machine

    You will then dive straight into natural language processing with the natural language toolkit (NLTK) for building a custom language processing platform for your chatbot. With this foundation, you ...

    Mastering.Data.Mining.with.Python.1785889958

    Dive deeper into data mining with Python – don't be complacent, sharpen your skills! From the most common elements of data mining to cutting-edge techniques, we've got you covered for any data-...

    深入Python_zh-cn[中文版]

    Dive Into Python.................................................................................................................1 Chapter 1. 安装 Python..................................................

    Thoughtful Data Science

    Chapter 5 Best Practices and Advanced PixieDust Concepts Chapter 6 Image Recognition with TensorFlow Chapter 7 Big Data Twitter Sentiment Analysis Chapter 8 Financial Time Series Analysis and ...

    Practical.Machine.Learning.178439968X

    Explore the future of Machine learning and dive deeper into polyglot persistence, semantic data, and more Table of Contents Chapter 1. Introduction to Machine learning Chapter 2. Machine learning and...

    Big.Data.for.Chimps.A.Guide.to.Massive-Scale.Data.Processing.in.Practice.epub

    Dive into map/reduce mechanics and build your first map/reduce job in Python Understand how to run chains of map/reduce jobs in the form of Pig scripts Use a real-world dataset—baseball performance ...

    Django.Unleashed.0321985079.epub

    Dive into Django source code to troubleshoot problems Extend site functionality with Django’s contributed library Protect your site with user authentication and permissions Avoid security pitfalls ...

    Building Recommendation Engines.epub

    Dive into the various techniques of recommender systems such as collaborative, content-based, and cross-recommendations Create efficient decision-making systems that will ease your work Familiarize ...

    Hands-On Machine Learning with Scikit-Learn and TensorFlow (epub)

    Dive into neural net architectures, including convolutional nets, recurrent nets, and deep reinforcement learning Learn techniques for training and scaling deep neural nets Apply practical code ...

Global site tag (gtag.js) - Google Analytics