Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python:并非所有参数都在字符串格式化期间转换 导入日期时间 now=datetime.date.today() now=str(now) index=open('/var/www/index.html','a') index.write('$s',%now) index.close()_Python_Html_String_Raspberry Pi - Fatal编程技术网

Python:并非所有参数都在字符串格式化期间转换 导入日期时间 now=datetime.date.today() now=str(now) index=open('/var/www/index.html','a') index.write('$s',%now) index.close()

Python:并非所有参数都在字符串格式化期间转换 导入日期时间 now=datetime.date.today() now=str(now) index=open('/var/www/index.html','a') index.write('$s',%now) index.close(),python,html,string,raspberry-pi,Python,Html,String,Raspberry Pi,我不断收到错误。您需要使用正确的格式: import datetime now = datetime.date.today() now = str(now) index = open('/var/www/index.html', 'a') index.write('<br> $s,' %now) index.close() index.write('%s',%now) 这是%s,而不是$s您需要使用正确的格式: import datetime now = datetime.d

我不断收到错误。

您需要使用正确的格式:

import datetime

now = datetime.date.today()
now = str(now)
index = open('/var/www/index.html', 'a')
index.write('<br> $s,' %now)
index.close()
index.write('
%s',%now)

这是
%s
,而不是
$s

您需要使用正确的格式:

import datetime

now = datetime.date.today()
now = str(now)
index = open('/var/www/index.html', 'a')
index.write('<br> $s,' %now)
index.close()
index.write('<br> %s,' %now)
index.write('
%s',%now)

这是
%s
,而不是
$s

您需要使用正确的格式:

import datetime

now = datetime.date.today()
now = str(now)
index = open('/var/www/index.html', 'a')
index.write('<br> $s,' %now)
index.close()
index.write('<br> %s,' %now)
index.write('
%s',%now)

这是
%s
,而不是
$s

您需要使用正确的格式:

import datetime

now = datetime.date.today()
now = str(now)
index = open('/var/www/index.html', 'a')
index.write('<br> $s,' %now)
index.close()
index.write('<br> %s,' %now)
index.write('
%s',%now)
这是
%s
,而不是
$s

索引.write(“
{now},”.format(now=now))
index.write('<br> %s,' %now)
.format
字符串格式好得多
请参见
index.write(“
{now},”.format(now=now))
.format
字符串格式好得多
请参见
index.write(“
{now},”.format(now=now))
.format
字符串格式好得多
请参见
index.write(“
{now},”.format(now=now))
.format
字符串格式好得多
请参见