我需要为作业制作一个网页,它不必上传到网络,我只是使用本地 .html 文件。我做了一些阅读并想出了以下 html 和 python:
<!DOCTYPE html>
<html>
<head>
<title>
CV - Rogier
</title>
</head
<body>
<h3>
Study
</h3>
<p>
At my study we learn Python.<br>
This is a sall example:<br>
<form action="/cgi-bin/cvpython.py" method="get">
First Name: <input type="text" name="first_name"> <br />
Last Name: <input type="text" name="last_name" />
<input type="submit" value="Submit" />
</form>
</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Python:
import cgi
import cgitb #found this but isn't used?
form = cgi.FieldStorage()
first_name = form.getvalue('first_name').capitalize()
last_name = form.getvalue('last_name').capitalize()
print ("Content-type:text/html\r\n\r\n")
print ("<html>")
print …Run Code Online (Sandbox Code Playgroud) 这应该是如此简单,这很愚蠢.但我无法让它发挥作用.我有一个标题,我在阅读文件时定义:
if "[gene=env]" in line or "[gene=HIV2gp7]" in line:
header = line
Run Code Online (Sandbox Code Playgroud)
现在这个标题看起来像">lcl|NC_001802.1_prot_NP_057856.1_8 [gene=env]"我需要附加一个数字,如下所示:
">lcl|NC_001802.1_prot_NP_057856.1_8 [gene=env]1"
我有100个相同的标题,必须编号为1到100但是无论我尝试什么,我都无法将数字放在同一行.总是输出
>lcl|NC_001802.1_prot_NP_057856.1_8 [gene=env]
1
>lcl|NC_001802.1_prot_NP_057856.1_8 [gene=env]
2
Run Code Online (Sandbox Code Playgroud)
等等
我试过了:
number = 0
for item in randoms[group_name]:
number+=1
headerx = str(header)+str(number)
print(headerx)
Run Code Online (Sandbox Code Playgroud)
还有无数其他的东西,却无法让它发挥作用.
给定以下数组:
foos = [
{
id: 0,
bar: ['a','b','c']
},
{
id: 1,
bar: ['a','b','d']
},
{
id: 2,
bar: ['a','c']
},
]
Run Code Online (Sandbox Code Playgroud)
使用reduce,我怎样才能实现以下目标?:
bars == ['a','b','c','d']
我试过了:
foo.reduce((bars, foo) => bars.add(foo.bar), new Set())
但它会产生一组对象:
Set { {0: 'a', 1: 'b', 2: 'c'}, {0: 'a', 1: 'b', 2: 'd'}{0: 'a', 1: 'c'}}
和:
foos.reduce((bars, foo) => foo.bar.forEach(bar => bars.add(bar)), new Set())
但forEach无法访问该bars集合。
我有一个用于UI的画布,其图像与画布大小相同.所述Image具有rgba的0,0,0,0,使之成为不可见的(因为a是0).我希望从脚本中将图像淡入黑色.这是我正在使用的代码:
public class NavigationC : MonoBehaviour {
public Image screen;
float fadeTime = 3f;
Color colorToFadeTo;
void StartGame()
{
colorToFadeTo = new Color(0f, 0f, 0f, 255f);
screen.CrossFadeColor(colorToFadeTo, fadeTime, true, true);
}
}
Run Code Online (Sandbox Code Playgroud)
现在,这在执行时没有做任何事情.但是当我a以统一方式手动更改图像的值以使图像变得可见时,我可以看到脚本改变了图像的颜色.因此脚本确实有效,它只是不可见,因为a脚本没有更改该值.那么如何让图像从隐形变为黑色呢?