# -*- coding: utf-8 -*
'''
Created on 2013-7-26
@author: lixingle
'''
#!/usr/bin/python
import math#导入数学函数
import codecs
print "hello"
print type (2)
#type 类型转换函数
print int('2')
print str(32)
#数学函数使用
print math
print math.log10(2)
print math.pi
print math.sqrt(2)#开方
#键盘输入
#myinput=raw_input('请输入你的姓名\n')
#print myinput
#字符串。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
fruit='banana'
print fruit[1]
length=len(fruit)
print length,'\n'
#遍历
for char in fruit:
print char
#字符串切片
numberstr='12345'
print numberstr[:]#12345
print numberstr[:3]#123
print numberstr[3:]#45
numberstr='abcde'
print numberstr.upper()#ABCDE
index=numberstr.find('c')
print 'the index is :',index#the index is : 2
#在3,4中找
index=numberstr.find('c',3,4)
print 'the index is :',index
#文件读取。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
fin=open('G://aa.txt').read().decode("gbk")
#print fin
#定义一个函数。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
def ifAinB(aword,bword):
for letter in aword:
if letter not in bword:
return False
return True
print ifAinB('123',