摘要:
a, b, c = 1, 3, 5 print(a, b, c) d = a if a > b else c # 三元操作符:如果 a>b 则 d=a 否则 d=c print(d) d = a if a < b else c # 三元操作符:如果 a<b 则 d=a 否则 d=c print(d) # 用三元操作符找出较小的那个 x, y = 3987, 24361 small = (... 阅读全文
摘要:
rep_word = 'The piece is gone, left the puzzle undone' # \ 换行,跟shell一样 with open('nothing', 'r', encoding='utf-8') as f, \ open('nothing1', 'w', encoding='utf-8') as f_new: for line in f... 阅读全文