摘要: 写博客啊,写博客\t ----------------三个空格%i---------------%i和%d几乎一样,表示有符号的十进制try ..except-----异常处理ast模块,ast.parsere模块,re.searchcontinuefrom __future__ import di... 阅读全文
posted @ 2014-12-20 09:09 batur 阅读(172) 评论(0) 推荐(0)
摘要: 将string中有元音字母的去掉,replace 函数1 def anti_vowel(text):2 for i in text:3 if i in "aeiouAEIOU":4 text=text.replace(i,'')5 return... 阅读全文
posted @ 2014-12-09 22:37 batur 阅读(163) 评论(0) 推荐(0)
摘要: BattleShip,这两个是新接触到的1)生成a,b之间的随机数:1 from random import randint2 randint(a,b)2)去掉list中的引号和逗号1 def print_board(board):2 for row in board:3 p... 阅读全文
posted @ 2014-12-04 16:31 batur 阅读(134) 评论(0) 推荐(0)
摘要: 正在Codecademy学习Python,在Battleship中的Printing Preety提到:print " ".join(letters)这个就将list中string的引号和逗号去掉,打印出来print "---".join(letters)这样就将元素用---连接起来例如这个代码: ... 阅读全文
posted @ 2014-12-03 20:12 batur 阅读(124) 评论(0) 推荐(0)