相关疑难解决方法(0)

如何分析Python脚本?

项目欧拉和其他编码竞赛通常有最长的运行时间或人们吹嘘他们的特定解决方案运行的速度.使用python,有时候这些方法有点像kludgey - 即添加时间码__main__.

分析python程序运行多长时间的好方法是什么?

python performance profiling time-complexity

1203
推荐指数
28
解决办法
47万
查看次数

如何使用Python解析复杂的文本文件?

我正在寻找一种将复杂文本文件解析为pandas DataFrame的简单方法.下面是一个示例文件,我希望解析后的结果和我当前的方法.

有没有办法让它更简洁/更快/更pythonic /更可读?

我也把这个问题放在Code Review上.

我最终写了一篇博客文章,向初学者解释这一点.

这是一个示例文件:

Sample text

A selection of students from Riverdale High and Hogwarts took part in a quiz. This is a record of their scores.

School = Riverdale High
Grade = 1
Student number, Name
0, Phoebe
1, Rachel

Student number, Score
0, 3
1, 7

Grade = 2
Student number, Name
0, Angela
1, Tristan
2, Aurora

Student number, Score
0, 6
1, 3
2, 9

School = Hogwarts …
Run Code Online (Sandbox Code Playgroud)

python regex parsing pandas

19
推荐指数
3
解决办法
2万
查看次数