how to use concatenate a fixed string and a variable in Python

前端 未结 6 1548
借酒劲吻你
借酒劲吻你 2020-12-05 23:16

I want to include file name \'main.txt\' in the subject for that I am passing file name from command line. but getting error in doing so

python sample.py ma         


        
6条回答
  •  独厮守ぢ
    2020-12-05 23:48

    Try:

    msg['Subject'] = "Auto Hella Restart Report " + sys.argv[1]
    

    The + operator is overridden in python to concatenate strings.

提交回复
热议问题