print('{0} a word she can get what she {1} for.'.format('With','came'))
With a word she can get what she came for.
>>> city = input("write down the name of city:")
write down the name of city:guangzhou
>>> url = "http://apistore.baidu.com/microservice/weather?citypinyin={}".format(city)
>>> print(url)
http://apistore.baidu.com/microservice/weather?citypinyin=guangzhou
>>> int('a')
读写文件函数构建:注意文件夹路径在mac和windows上的区别
def text_create(name,msg):
**desktop_path = '/Users/apple/Desktop/'**
full_path = desktop_path + name + '.txt'
file = open(full_path, 'w')
file.write(msg)
file.close()
print('Done')
text_create('hello','hello world')
python文件文本操作方法,format的使用
最新推荐文章于 2023-03-21 20:18:58 发布