摘要:
1.大小写转换 判断字符串 s.isalnum() #所有字符都是数字或者字母 s.isalpha() #所有字符都是字母 s.isdigit() #所有字符都是数字 s.islower() #所有字符都是小写 s.isupper() #所有字符都是大写 s.istitle() #所有单词都是首字母 阅读全文
摘要:
1.输入输出 输出实例 print 'hello','world' hello world 输入实例 name = raw_input(); print "hello,",name world hello,world 输入时提示实例 name = raw_input('please enter yo 阅读全文
摘要:
1.简介 python 提供内置函数map(), 接收两个参数,一个是函数,一个是序列,map将传入的函数依次作用到序列的每个元素,并把结果作为新的list返回。例如: (1)对于list [1, 2, 3, 4, 5, 6, 7, 8, 9]如果希望把list的每个元素都作平方,就可以用map() 阅读全文
摘要:
random是内建(built-in)函数,作用是产生随机数,使用较多. 1.导入模块 首先是导入模块: import random 接着就可以调用random模块下的函数了,例如: random.randint(1,100) 语句的含义是产生1至100(包含1与100)的一个随机数。 也可以: f 阅读全文