# coding:utf-8
"""设置utf8编码,防止出现中文乱码的情况"""
'''type()函数可用来查看变量类型'''
print(type('你好!'))
#整理第三方库的网站 awesome-python
import sys
print(sys.path) #查找库的安装路径
'''字符串replace'''
phone_number = '188-888-88888'
hiding_number = phone_number.replace(phone_number[:9],'*'*9)
print(hiding_number)
'''.format()实现批处理'''
city = input('write down the name of city:')
url = "http://apistore.baidu.com/microservice/weather?citypinyin={}".format(city)
print(url)
print('hello world!')
file = open('hello.txt', 'w')
file.write('hello world!')
'''replace的用法'''
word = 'python is lame!'
words=word.replace('lame', 'awesome')
print(words)
'''成员运算符 in/not in 和身份运算符 is/is not'''
'''
条件判断
if condition:
do somethong
elif condition:
do somethong
else :
do somethong
'''
'''
循环
for是关键词,在关键词in后面所对应的一定是具有‘可迭代的’或者是像列表那样的集合形态的对象。
'''
for every_letter in 'hello world':
print(every_letter)
for num in range(1,11):
print(str(num)+'+1=',num+1,'end',sep='\n')
'''print输出控制: sep对同一个print有效,end对不同的print有效'''
'''python 除法取整数 //;取余数 %'''
nu = 1
while (nu<101):
if (nu % 2 ==0):
print(nu,end=' ')
nu = nu+1