码迷,mamicode.com
首页 >  
搜索关键字:strip    ( 2365个结果
python脚本二
#!/usr/bin/python a="a.txt" f=file(a) c=f.readlines() whileTrue: user_input=raw_input("plzinputyourname:").strip() iflen(user_input)==0:continue forlineinc: ifuser_inputinline: printline, break else: print"itisnottheuser"
分类:编程语言   时间:2015-07-02 01:15:45    阅读次数:154
python脚本
#-*-coding:utf-8-*- importsys user="wangru" counter=0 whileTrue: ifcounter<3: name=raw_input("pleaseinputyourname:").strip() iflen(name)==0: print"thenameisnull,tryagain" continue elifname==user: pass else: print"theuser%sisnotrighttryagain"%name coun..
分类:编程语言   时间:2015-07-01 06:24:31    阅读次数:163
python初始---程序一(login登陆)
#!/bin/bash/envpythonwhileTrue:user_name=raw_input(‘whatisyourname?‘).strip()iflen(user_name)==0:print"pleaseinputyouruser_name.ifyounot,pleaseregister!"continueelse:file=open(‘/root/passwd‘)state=0#nologinname_n=0#noaccountuser_pass=raw_input(‘whatisyourpa..
分类:编程语言   时间:2015-06-29 22:25:00    阅读次数:229
Python学习笔记-小记
1.字符串string判断一个字符(char)是数字还是字母 str.isalpha #判断是否为字母 str.isdigit #判断是否为数字判断一个字符串是否为空if not str.strip(): #判断是否为空,true表示空向字符串添加内容str = ''.join('love')得到字符串固定长度的字串str = str1[1:3] #得到从下标1开始到下标3之前的字符,下标3的字符不...
分类:编程语言   时间:2015-06-27 09:56:49    阅读次数:131
序列判断
stopword=‘‘ str=‘‘ forlineiniter(raw_input,stopword): str+=line+‘\n‘ L=str.strip().split(‘\n‘) L_num=[] forcinL: L_num.append(int(c)) L_down=L_num[:] L_up=L_num[:] L_down.sort(reverse=1) L_up.sort() print‘L_down=‘,L_down print‘L_up=‘,L_up ifL_num==L_down: p..
分类:其他好文   时间:2015-06-25 01:36:40    阅读次数:150
相同数字
stopword=‘‘ str=‘‘ forlineiniter(raw_input,stopword): str+=line+‘\n‘ L=str.strip().split(‘\n‘) L_set=set(L) iflen(L)==len(L_set): print‘NO‘ else: print‘YES‘给你一个整数列表L,判断L中是否存在相同的数字, 若存在,输出YES,否则输出NO。
分类:其他好文   时间:2015-06-24 19:22:36    阅读次数:129
js验证表单大全
用途:校验ip地址的格式 输入:strIP:ip地址 返回:如果通过验证返回true,否则返回false; */ function?isIP(strIP)?{ if?(isNull(strIP))?return?false; var?re=/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/g?//匹配...
分类:Web程序   时间:2015-06-24 13:09:12    阅读次数:178
程序减肥,strip,eu-strip 及其符号表
程序减肥,strip,eu-strip 及其符号表 我们要给我们生成的可执行文件和DSO瘦身,因为这样可以节省更多的磁盘空间,所以我们移除了debug信息,移除了符号表信息,同时我们还希望万一出事了,比如coredump了,我们能获取更多的信息,这时候我们又希望有符号表。 我们等不能做到呢。Linu...
分类:其他好文   时间:2015-06-24 07:04:52    阅读次数:158
alex教学视频--购物表
让用户输入工资输出购物菜单及产品价格计算用户是否可支付输出用户剩余的钱,问用户是否继续购物,如果选择继续,继续进行,直到钱不够为止#coding:UTF-8 importsys whileTrue: try: salary=int(raw_input(‘Pleaseinputyoursalary:‘).strip()) break except: print‘Pleaseinput..
分类:其他好文   时间:2015-06-22 18:02:40    阅读次数:172
python数据处理
一、基本函数篇1)python strip()函数介绍函数原型声明:s为字符串,rm为要删除的字符序列s.strip(rm) 删除s字符串中开头、结尾处,位于 rm删除序列的字符s.lstrip(rm) 删除s字符串中开头处,位于 rm删除序列的字符s.rstrip(rm) 删除s字符串中结尾处,位...
分类:编程语言   时间:2015-06-21 14:18:11    阅读次数:153
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!