list、tuple、dict加*星号
*相当于解压的作用,当list中只有一个元素时,利用*作用相当于直接去[],去[]后的数据类型是字符串。
_list = [1,2,3] _tuple = (1,2,3) _dict = {1:'a', 2:'b', 3:'c'} print('_list is', *_list) print('_tuple is', *_tuple) print('_dict is', *_dict) # _list is 1 2 3 # _tuple is 1 2 3 # _dict is 1 2 3
参考:https://blog.csdn.net/weixin_40877427/article/details/82931899