zoukankan      html  css  js  c++  java
  • Python Learning: 01

      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.

    When you return with glory, you will be bathed in the golden rain.
  • 相关阅读:
    [loj6484]LJJ爱数书
    [loj3163]动态直径
    [loj2983]数树
    [luogu3785]文本校正
    [loj2572]字符串
    [loj3103]节日庆典
    [atARC118F]Growth Rate
    [atARC118E]Avoid Permutations
    [cf794G]Replace All
    [cf756E]Byteland coins
  • 原文地址:https://www.cnblogs.com/DrunkYouth/p/10355751.html
Copyright © 2011-2022 走看看