a.isdigit()判断是不是纯数字,是Trueimportstringifiinstring.digits:判断是不是存数字os.listdir(‘/home‘)列出所有文件,只有一层,以列表形式os.listdir(‘.‘)列出文件os.path.dirname(__file__)当前目录,就是脚本所在目录os.path.abspath(‘tmp‘)tmp这个文件或者文件夹的绝..
分类:
编程语言 时间:
2017-02-28 14:07:18
阅读次数:
186
#写一个程序,判断给到的年份是否为闰年 temp=input('请输入一个年份:') while temp.isdigit()==False: temp=input('该吃药了吧,重新输入:') year=int(temp) if ((year%4==0) and (year%100!=0)) or ...
分类:
其他好文 时间:
2017-01-31 14:23:28
阅读次数:
112
数据类型 数据操作 bytes 类型 "".encode() 编码-->二进制 "".decode() 解码 判断字符串里的字符是否全为数字 "".isdigit(), Return True if all characters in S are digits 数据运算: 算数运算: + - * / ...
分类:
编程语言 时间:
2017-01-17 10:49:29
阅读次数:
227
同步 所谓同步,就是在发出一个功能调用时,在没有得到结果之前,该调用就不返回。按照这个定义,其实绝大多数函数都是同步调用(例如sin, isdigit等)。但是一般而言,我们在说同步、异步的时候,特指那些需要其他部件协作或者需要一定时间完成的任务。最常见的例子就是 SendMessage。该函数发送 ...
分类:
其他好文 时间:
2017-01-11 10:05:05
阅读次数:
174
1 def jisuan(x) : 2 al_num = 0 3 spance_num = 0 4 digit_num = 0 5 other_num = 0 6 for i in x : 7 if i.isdigit() : 8 digit_num += 1 9 elif i.is... ...
分类:
其他好文 时间:
2016-12-23 18:56:29
阅读次数:
126
#Author:xuhan#-*-coding:utf-8-*-shopping_car=[]whileTrue:salary=input(‘[q=quit]请输入您的购物预算:‘)ifsalary.isdigit():breakelse:continueprint(‘欢迎光临家乐福购物中心‘.center(60,‘-‘))product_list=[(‘Iphone7‘,5999),(‘MacAre‘,6999),(‘UNIQL‘,200)]choice_flag=‘..
分类:
编程语言 时间:
2016-12-13 16:46:45
阅读次数:
301
购物车程序 (一): 整体流程 拆件流程: 1.输入工资 salary=input("Input your Money")if salary.isdigit(): #判断是否为数字 salary=int(salary)else: exit("Invalid data type...")welcom_ ...
分类:
其他好文 时间:
2016-12-03 18:33:45
阅读次数:
190
1、布尔类型 字符串 常用的操作方法 .count() .find() .join() .encode() .decode()#这个是bytes类型才有的 .endswith('.txt')#字符串是否以xx结尾 startswith('A')#字符串是否以xx开头 .isdigit() .stri ...
分类:
编程语言 时间:
2016-11-18 06:35:05
阅读次数:
226
字符串 常用的操作方法 .count() .find() .join() .encode() .decode() .endswith() .startswitch('A') .isdigit() .strip() .replace('xx','') .split(',')#以xx来分割字符串,返回的 ...
分类:
编程语言 时间:
2016-11-17 23:51:00
阅读次数:
226
1.开发一个购物车程序 要求:选定商品后需要减少相应的金额并将商品存入购物车 salary=input("卡内金额:") if salary.isdigit(): salary = int(salary) else: print("请输入正确的数据类型") shop_list=[ ('苹果5S',4 ...
分类:
其他好文 时间:
2016-11-17 20:17:47
阅读次数:
260