File "/root/Python/city.py", line 15, in <module> print("广州","上海","深圳", seq="-") TypeError: 'seq' is an invalid keyword argument for print()
时间: 2023-07-17 22:10:14 浏览: 127
在 Python 2 中,`print` 函数不支持关键字参数 `sep`。您可以使用逗号 `,` 来分隔要打印的多个值,并且它们会以空格作为默认分隔符。请尝试以下代码:
```python
#coding=utf-8
print "中国三大火炉城市:"
print "上海"
print "武汉"
print "重庆"
print "广州", "上海",深圳"
```
这样,广州、上海和深圳之间将以空格分隔。
相关问题
multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/zyh2/anaconda3/envs/ztorch/lib/python3.7/multiprocessing/pool.py", line 121, in worker result = (True, func(*args, **kwds)) File "/home/zyh2/anaconda3/envs/ztorch/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar return list(map(*args)) File "encode_seq.pyx", line 73, in GCNFrame.encode_seq.matrix_encoding File "encode_seq.pyx", line 64, in GCNFrame.encode_seq._matrix_encoding File "encode_seq.pyx", line 30, in GCNFrame.encode_seq._loc_transfer_matrix TypeError: 'float' object cannot be interpreted as an integer """ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/zyh2/vit-pytorch-main/vit_pytorch/gene2classTest.py", line 9, in <module> dataset = data.encode(thread=20) File "/home/zyh2/vit-pytorch-main/GCNFrame/Biodata.py", line 134, in encode feature = np.array(pool.map(partial_encode_seq, seq_list)) File "/home/zyh2/anaconda3/envs/ztorch/lib/python3.7/multiprocessing/pool.py", line 268, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/home/zyh2/anaconda3/envs/ztorch/lib/python3.7/multiprocessing/pool.py", line 657, in get raise self._value TypeError: 'float' object cannot be interpreted as an integer
这是一个 Python 的异常信息,看起来是在使用 multiprocessing.pool 进行并行编码时出现了错误。具体的错误信息是 "float" 对象无法解释为整数。这可能是由于在 GCNFrame.encode_seq._loc_transfer_matrix 函数中,类型错误导致的。建议检查代码中的数据类型,确保传递给函数的参数是正确的数据类型。
阅读全文