#!/usr/bin/env python3
# -*- coding: utf-8 -*-

#转义字符
print('I\'m \"ok\"')

print()

n = 123
print(n)
f = 456.789
print(f)
s1 = 'Hello,world'
print(s1)
s2 = 'Hello,\\\'Adam\\\''
print(s2)
s3 = 'r\'Hello,\"Bart\"'
print(s3)
s4 = 'r\'\'\'Hello,Lisa!\'\'\''
print(s4)

'''
#encode() 编程为指定的bytes
'ABC'.encode('ascii')
'中文'.encode('utf-8')
'中文'.encode('ascii')#不能将中文字符用ascii编码

#decode() 编程为指定的str
 b'ABC'.decode('ascii')
 b'\xe4\xb8\xad\xe6\x96\x87'.decode('utf-8')
 
 
 #str 用len()函数 计算字符数
 len('ABC')
 
 #bytes 用len()函数 计算比特数
 len('中文'.encode('utf-8'))
 
'''

'''
 #格式化
'Hello,%s'%'world'
'%2d-%02d'%(3,1)
'%.2f'%3.1415926
'''

'''
#计算成绩绩点
s1 = 72
s2 = 85
r = (s2-s1)/s1*100
print('grouth rate = %.1f%%'%r)
'''
