Python Learning Note 1

Source: Internet
Author: User
Tags function definition

According to a high-ticket answer to the Thu of the Great God Study
http://nbviewer.jupyter.org/github/lijin-THU/notes-python/tree/master/
Just sort of something I don't think I'm familiar with.
For Acmer or some familiar with C + + children's shoes should have some reference, I think
I think Python is a future language that will someday replace C++,java
To be more simplified
Just like the relationship between the Assembly and C.

CHAT1 Tools

Although I have learned a bit of python before, I hope this time we can learn the language more systematically and lay a good foundation for the future.

dict.get(key, default=None)# dict是字典类型,返回查找key的值# 如果不存在,返回default
%whos#查看当前变量空间%-f#清空变量空间
%%writefile hello_world.pyprint"hello world"# 将这行字写到hello_world.py当中去
%rmdir demo_test# 删除文件集%hist# 查看历史命令
sum?#使用??查看函数帮助和函数源代码
=12+13#_使用上一个cell的输出结果

After installing Anaconda for the first time, you can enter the following command at the command line to keep Anaconda up to date:

conda update condaconda update anaconda

Conda is a powerful tool that can be used to refer to its documentation.

You can also refer to its cheat sheet for a quick look at its usage.

You can use it to install, update, and uninstall third-party python toolkits:

conda<some package>conda<some package>conda<some package>
CHAT2 Part 1 A-TOUR-OF-PYTHON.IPYNB
import numpydel numpy# 撤销引入
="""helloworld"""print s# “”“来表示换行

Use of List

= [12.0‘hello‘5+1.0]a.append("world")

Use of Set

= {1234= {2345&|^ b#对称差,也就是两个集合所独有的元素

Use of Dictionary

= {‘dogs‘:5‘cats‘:4}d["pigs"]d.keys()d.values()

Numpy.array

= array([1234+2# python自带也是有array数组的,这里使用

Use of the list deduction formula

42964299

File operations

=open(‘data.txt‘‘w‘)f.write(‘1 2 3 4\n‘)f.write(‘2 3 4 5\n‘

function definition

def poly(x, a, b, c):    =***2+*+ c    return=1poly(array([123123)# 这里注意必须使用numpy的转化

The creation of class classes

class  person (): def  __init__  (self , First, last, age): self . First =  first self . Last = last self . Age =  age def  full_name (
    
     self ): 
     return  
     self . First 
     +  " +  self . Last person =  person ( ' Mertle ' ,  ' Sedgewick ' , 52 ) person.firstperson.full_name () Person.basasuya =  Dperson.basasuya # here you can find that the element of person is a  
     
that can be added randomly.
=‘http://ichart.finance.yahoo.com/table.csv?s=GE&d=10&e=5&f=2013&g=d&a=0&b=2&c=1962&ignore=.csv‘import= urllib2.urlopen(url)# web使用

Python Learning Note 1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.