语法错误:%time泡菜。倾倒

2024-09-30 03:22:48 发布

您现在位置:Python中文网/ 问答频道 /正文

有人能给我解释一下%时间是怎么工作的吗? 我从一本书上得到这个,但每次我使用它,我都会出错。 语法错误:语法无效

path = '/home/foad/PythonBoken/flash/'

import numpy as np
from random import gauss

a = [gauss(1.5, 2) for i in range(100000)] #generation of normally distributed randoms

#Write this list above to disk for later retrieval
import pickle 

pkl_file=open(path + 'data.pkl', 'w') #open file for writing. Existing file may be overwritten

%time pickle.dump(a, pkl_file)

Tags: pathimporthomefor时间语法openpickle

热门问题