Learn Python The Hard Way

Cookouts:
- Thinking, Writing and Reading code everyday.
- Read code backward.
- Focus on details.
- Write comments.
- Write down mistakes you had mad, read it before next code.
- A Best VPN
https://www.expressvpn.xyz?referrer_id=9482250&utm_campaign=referrals&utm_medium=copy_link&utm_source=referral_dashboard

Exercise 1
http://stackoverflow.com/questions/3249524/print-in-one-line-dynamically

http://stackoverflow.com/questions/5087425/python-difference-between-using-and

# -*- coding: utf-8 -*-

Put it at the top of the code will fix the ASCII encodings error.

Exercise 2
It can be wrong when you use chinese characters in comment.

Exercise 4
http://stackoverflow.com/questions/6360242/why-does-he-uses-a-floating-point-in-this-example/6360355#6360355

Exercise 5
http://stackoverflow.com/questions/15170349/whats-the-difference-between-r-s-and-d-in-python

http://stackoverflow.com/questions/6005159/when-to-use-r-instead-of-s-in-python

http://stackoverflow.com/questions/4480278/list-of-python-format-characters

http://stackoverflow.com/questions/56820/round-in-python-doesnt-seem-to-be-rounding-properly

Exercise 6

# New way to use format characters
judge = True
court = "Is he guilty?! %r"
print court % judge

http://stackoverflow.com/questions/10043636/any-reason-not-to-use-to-concatenate-two-strings

http://stackoverflow.com/questions/34626470/why-does-plus-can-concatenate-two-strings-in-python

Exercise 8
http://stackoverflow.com/questions/36144557/how-can-i-nest-format-string-in-python2

Exercise 9
http://stackoverflow.com/questions/34634532/what-happened-with-formatter-r-and-n-in-python

Exercise 10
http://stackoverflow.com/questions/16076775/python-escape-sequence-nname-not-working-as-per-definition

while True:
    for i in ['/', '-','|', '\\', '|']:
        print '%s\r' % i,

http://stackoverflow.com/questions/3329775/what-does-this-stand-for

http://stackoverflow.com/questions/26184100/how-does-v-differ-from-x0b-or-x0c

\a ASCII Bell (BEL)
\b ASCII Backspace (BS)
\uxxxx Character with 16-bit hex value xxxx(Unicode only)
\Uxxxxxxxx Character with 32-bit hex value xxxxxxxx (Unicode only)
\ooo Character with octal value ooo
\xhh Character with hex value hh

http://stackoverflow.com/questions/2672326/what-does-a-leading-x-mean-in-a-python-string-xaa

Exercise 11
http://stackoverflow.com/questions/5563089/raw-input-function-in-python

Exercise 12
https://docs.python.org/2/library/pydoc.html#module-pydoc

Exercise 13
http://stackoverflow.com/questions/25675223/how-to-use-raw-input-with-argv/36156982#36156982

Exercise 15
http://stackoverflow.com/questions/36152151/reading-file-in-python-sometimes-it-shows-all-the-content-sometimes-just-shows-t

Exercise 16
http://stackoverflow.com/questions/16208206/confused-by-python-file-mode-w

http://stackoverflow.com/questions/21019942/write-multiple-lines-in-a-file-in-python

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值