欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Python Learning: 01

程序员文章站 2023-09-01 09:28:45
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 ......

  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 1 h=('drunk',1)
2 2 o=('youth',0)
3 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.