I'm currently attempting to set a Cookie header with the following HTTPInterceptor:
@Injectable()
export class TokenInterceptor implements HttpInterceptor {
constructor(private cookieService: CookieService ) {}
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
request = request.clone({
setHeaders: {
'Cookie': 'session=' + this.cookieService.get('session'),
'withCredentials': 'true',
}
});
return next.handle(request);
}
}
Run Code Online (Sandbox Code Playgroud)
When attempting to set the Cookie I get the following error:
Refused to set unsafe header "Cookie"
I'm making the request to a local Flask API.
I have attempted to manually set …
我有一个results.txt看起来像这样的文件:
[["12 - 22 - 30 - 31 - 34 - 39 - 36"],
["13 - 21 - 28 - 37 - 39 - 45 - 6"],
["2 - 22 - 32 - 33 - 37 - 45 - 11"],
["3 - 5 - 11 - 16 - 41 - 48 - 32"],
["2 - 3 - 14 - 29 - 35 - 42 12"],
["14 - 30 - 31 - 36 - 44 - 47 26"]]
Run Code Online (Sandbox Code Playgroud)
我想用'","'替换results.txt文件中的" …
我试图创建一些列表,具体取决于我的header_count中的数字.下面的代码应该生成3个列表,但我得到语法错误.
header_count = 4
for i in range(1, header_count):
header_%s = [] % i
Run Code Online (Sandbox Code Playgroud) 我在R中生成了以下图表:

在Y轴上,我有蛋白质名称以及以.pdb结尾的文件名.如何在一行上生成蛋白质名称,在下一行中创建文件名?
我使用以下命令生成图:
library(lattice) <br>
data <- read.table("~/Documents/R/test.txt", header=F, sep="\t") <br>
dotplot(V1~V2, xlim=c(0, 2.5), xlab="RMSD Distribution", data=data)
Run Code Online (Sandbox Code Playgroud)
示例输入文件如下所示:
Serum Amyloid P Pentamer: 1sac.pdb 0.7125 <br>
Serum Amyloid P Pentamer: 1sac.pdb 0.7917 <br>
Serum Amyloid P Pentamer: 1sac.pdb 0.7819 <br>
Serum Amyloid P Pentamer: 1sac.pdb 0.7762 <br>
Serum Amyloid P Pentamer: 1sac.pdb 1.0233 <br>
Serum Amyloid P Pentamer: 1sac.pdb 0.6896 <br>
Run Code Online (Sandbox Code Playgroud)
不显示值和文件之间的选项卡.
当我在下面运行我的代码时,我得到了一个:ValueError: invalid literal for int() with base 10: '0.977759164126'但我不知道为什么
file_open = open("A1_B1_1000.txt", "r")
file_write = open ("average.txt", "w")
line = file_open.readlines()
list_of_lines = []
length = len(list_of_lines[0])
total = 0
for i in line:
values = i.split('\t')
list_of_lines.append(values)
count = 0
for j in list_of_lines:
count +=1
for k in range(0,count):
print k
list_of_lines[k].remove('\n')
for o in range(0,count):
for p in range(0,length):
print list_of_lines[p][o]
number = int(list_of_lines[p][o])
total + number
average = total/count
print average
Run Code Online (Sandbox Code Playgroud)
我的文本文件如下:
0.977759164126 0.977759164126 …
我使用以下代码来组合两个文本文件:
def combine_acpd_ccs(self, ccs_file, acps_file, out_file):
with open(ccs_file, 'r') as in_file1:
with open(acps_file, 'r') as in_file2:
with open(out_file, 'w') as out1:
out1.write('PDB\tPA\tEHSS\tACPS\n')
for line in in_file1:
segs = line.split()
for i in in_file2:
sse_score = i.split()
#print line
#print segs
if segs[0][:-4] == sse_score[0]:
out1.write(segs[0][:-4]+'\t'+segs[1]+'\t'+segs[2]+'\t'+sse_score[1]+'\n')
Run Code Online (Sandbox Code Playgroud)
示例数据如下所示:
ccs_file:
1b0o.pdb 1399.0 1772.0
1b8e.pdb 1397.0 1764.0
Run Code Online (Sandbox Code Playgroud)
acps_file:
1b0o 0.000756946316066
1b8e 8.40662008775
1b0o 6.25931529116
Run Code Online (Sandbox Code Playgroud)
我期待我的表现如下:
PDB PA EHSS ACPS
1b0o 1399.0 1772.0 0.000756946316066
1b0o 1399.0 1772.0 6.25931529116
1b8e 1397.0 1764.0 8.40662008775
Run Code Online (Sandbox Code Playgroud)
但是我的代码只生成了我预期输出的前两行.如果我segs在第二个 …
我有一个atoms.out执行某些功能的fortran 文件.我在python中调用fortran文件:
values = subprocess.Popen(["./atoms.out", "./%s.klj" % test1, "./%s.out" % test1], stdout = subprocess.PIPE)
Run Code Online (Sandbox Code Playgroud)
我看过Python PP,但我认为这不是我要找的,因为它为一个作业使用了n个CPU.
fortran文件进行的计算不是独立的,不能用于 python pp
所以我的问题是如何将一些作业提交给许多不同的CPU,例如我有:7个文件,我希望在4个CPU上运行.
因此,每项工作分配如下:
File1 -> CPU1
File2 -> CPU2
File3 -> CPU3
File4 -> CPU4
Run Code Online (Sandbox Code Playgroud)
然后,当一个作业在CPU上完成时,它将替换为剩余的3个要运行的文件.说File1在完成CPU1它被更换File5,所以作业的分配将是这样的:
File5 -> CPU1
File2 -> CPU2
File3 -> CPU3
File4 -> CPU4
Run Code Online (Sandbox Code Playgroud)
等等,直到它完成了对7个文件运行fortran文件.