0
一直在尋找解決方案一整天,但沒有任何幫助。 無論如何,我一直在試圖做的是將一個日期和時間添加到無線網絡流記錄的文件名。但我不斷收到錯誤消息:Python:添加日期和時間到電臺網頁流記錄
File "streamrunskyplus.py", line 9, in filename = 'home/somebody/streams/streamrunskyplus.py'%datetime.datetime.utcnow().strftime("%Y%m%d-%H%M%S") TypeError: not all arguments converted during string formatting
這裏是你必須把一個%在你的第一個字符串代碼本身
import subprocess
import os
import datetime
os.system("command")
subprocess.call(['streamripper', 'http://stream05.akaver.com/skyplus_low.ogg', '-d', './streams', '-l', '20', '-a', 'Skyplus', ])
filename = 'home/somebody/streams/streamrunskyplus.py'%datetime.datetime.utcnow().strftime("%Y%m%d-%H%M%S")