File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ #对URL进行分割
2+ # XXG 2012-10-23
3+
4+ url = raw_input ("input the url:" )
5+ if (url [0 :4 ] == 'http' ):
6+ domain = url [11 :- 4 ]
7+ elif (url [0 :3 ] == 'www' ):
8+ domain = url [4 :- 4 ]
9+
10+ print "Domain name :" + domain
11+
12+ #思考: 如:http://www.xxxx.edu.cn
13+ # https://xxx.cn /com.cn 怎么处理 split('.')
Original file line number Diff line number Diff line change 1+ #以正确的宽度在居中的盒子内打印一个句子
2+
3+ sentence = raw_input ("Sentence:" )
4+
5+ screen_width = 80
6+ text_width = len (sentence )
7+ box_width = text_width
8+ left_margin = (screen_width - box_width ) // 2
9+
10+
11+ print
12+ print ' ' * left_margin + '+' + '-' * box_width + '+'
13+ print ' ' * left_margin + '|' + ' ' * text_width + '|'
14+ print ' ' * left_margin + '|' + sentence + '|'
15+ print ' ' * left_margin + '|' + ' ' * text_width + '|'
16+ print ' ' * left_margin + '+' + '-' * box_width + '+'
Original file line number Diff line number Diff line change 1+ #ÑéÖ¤Óû§ÃûºÍPINÂë
2+
3+ database = [
4+ ['hello' ,'1' ],
5+ ['world' ,'2' ],
6+ ['!' ,'3' ]
7+ ]
8+
9+ username = raw_input ("input the user name:" )
10+ pin = raw_input ("input tne user pin:" )
11+
12+ if [username ,pin ] in database :
13+ print "Access greanted"
14+ else :
15+ print "Error pin code or username"
16+
You can’t perform that action at this time.
0 commit comments