Python Learning: 01

奎恩東特發表於2019-02-07

  After a short period of  new year days, I found life a little boring. So just do something funny–Python. Before we begin, what we should know first is that Python is a dynamic language, which means the type of data of every varieable

  • Differences Between Python2 and Python3

    As the version I download is Python, which I found something wrong with the studying video, I look through some websites.The first point need paying attention to is the change of function `print`, which can be used as output sentense in P2 while can be used as a function in P3.

  • Unicode in Python

    if we met ” UnicodeDecodeError” when coding, add a note line at the first line.

         1 # -*- coding: utf-8 -*- 
  • Comparation between List and Tuple

List:

1 H=[`Drunk`,1]
2 O=[`Youth`,0]
3 G=[]

Tuple:

1 H=(`drunk`,1)
2 O=(`Youth`,0)
3 G=((`Drunk`,0),[`Youth`,1])

    The greatest difference between them is the whether can be changed. Tuple is determined as long as it is defined, while List can be changed by append(), insert(), pop(). But there is a exception that the List in Tuple can alse be changed.

     To be continued.

相關文章