The use of commas in type conversions is mainly the conversion of tuples
For example:
>>> a=11
>>> b= (a)
>>> b
11
>>> b= (A,)
>>> b
(11,)
>>> b= (a,22)
>>> b
(11, 22)
>>> b= (a,22,)
>>> b
(11, 22)
>>>
It can be seen that a comma is required to convert to a tuple type when there is only one element in the B-tuple
In addition, this multi-threaded comma is very interesting, once removed, the program will be error
#coding =utf-8
Import threading
From time import Ctime,sleep
def music (func):
For I in range (2):
Print ("I was listening to%s.%s"% (Func,ctime ()))
Sleep (1)
def move (func):
For I in range (2):
Print ("I am at the%s! %s "% (Func,ctime ()))
Sleep (5)
Threads = []
T1 = Threading. Thread (target=music,args=(U ' Love Business ',))
Threads.append (T1)
T2 = Threading. Thread (target=move,args=(U ' Avatar ',))
Threads.append (T2)
if __name__ = = ' __main__ ':
For T in Threads:
T.setdaemon (True)
T.start ()
T.join ()
Print ("All over%s"%ctime ())
An example analysis of the role of commas in python