# 单行注释 print ( "hello world" ) ''' 多行注释测试 python ''' """ 多行注释测试 """ user_name = 'Charlie' user_age = 8 print ( type ( user_name )) # class 'str' print ( "读者名:" , user_name , "年龄:" , user_age , sep =
print("hello world")
'''
多行注释测试
python
'''
"""
多行注释测试
"""
user_name = 'Charlie'
user_age = 8
print(type(user_name))
# <class 'str'>
print("读者名:", user_name,"年龄:",user_age, sep='|')
# 读者名:|Charlie|年龄:|8
#字符串拼接
s1 = "Hello," 'Charlie'
print(s1)
s2 = "Python "
s3 = "is Funny"
s4 = s2 + s3
print(s4)
s1 = "这本书的价格是:"
s2 = 98
print(s1 + str(s2))
#字符串的分割与链接
s = 'crazyit.org is a good site'
print(s.split())
print(s.split(None, 2))
print(s.split('.'))
list = s.split()
print(list)
#使用'/'作为分割符,将list连接成字符串
print('/'.join(list))
#使用'.'作为分割符,将list连接成字符串
print('.'.join(list))
#使用python打开文件夹,获取文件
path = "文件夹路径"
list = os.listdir(path)
for i in list:
print(i)