Python Learning Note

Never, never and never give up!!!

  1. python version 2.7
  2. interactive interpreter: practice python in command line
  3. Python Data Type
    • Numbers
    • Strings: escape characters by default. Use print to avoid unreadable escape characters
      Use raw key words and you don’t need to add escape backslash for each escape characters.
      multiple line string: use ” ” ” … ” ” ”
      concatenate string: use ‘+’
      multiple string: use ‘*’
      Two or more string listed adjacent are concatenated by default
      But that only works for literal strings, not variables or expressions
      1. characters in a string in Python can be visited by indices, when -1 is used, starting from right
      2. slicing: str[0:2] #from indices 0 to indices 2(excluded)
        • how start is included? str[:2]
        • how end is included? str[2:]
      3. indices out of bound is treated as error, but slices out of bound are treated elegantly
      4. characters in a string are immutable
      5. len() returns the length of a string
      6. str() returns ASCII string
      7. encode takes one parameter: of the lower-case named encoding name
    • compound data types:
      1. List
        indices and slicing are similar; but List elements are not unimmutable
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值