-1

我有一封来自我大学的短信,实际上是一封电子邮件,如下所示:

FEDERAL UNIVERSITY OF ABC

Name : Rodrigo Martins de Oliveira
RA: 11009713
Campus : Campus Santo André
Shift: Morning

weekly charge
=============
Credit (T-P) : 18
Load - time (T-P-I) : 44

Requested enrollment in the following classes :
=================================
  BC0208 - Mechanical Phenomenons A2-Morning (Santo André) - TPI (3-2-6) - Campus St. André
  Tuesday from 10:00 to 12:00
  Tuesday from 08:00 to 10:00
  Thursday from 08:00 to 10:00
  BC0504 - The Nature of Information A2-Morning (Santo André) - TPI (3-0-4) - Campus St. André
  Friday from 08:00 to 10:00
  Thursday from 10:00 to 12:00
  BC0306 - Transformations in Living Beings and Environment A1-Morning (Santo André) - TPI (3-0-4) - Campus St. André
  Wednesday from 08:00 to 10:00
  Monday from 10:00 to 12:00
  BC0402 - One Variable Functions A1-Morning (Santo André) - TPI (4-0-6) - Campus St. André
  Monday from 08:00 to 10:00
  Wednesday from 10:00 to 12:00
  BC0404 - Analytic Geometry A2-Morning (Santo André) - TPI (3-0-6) - Campus St. André
  Wednesday from 08:00 to 10:00
  Friday from 10:00 to 12:00


Code of authenticity : 4TlG58kWtrdN1caEJM02Ik8/C01p + qLeSFDOtXHZLMJrafv3H/soML2XPkrU pBHmBXBwMgRbd7Y =



Note : Document for simple conference, follow in the site the results of this enrollment request.

-
This email was sent automatically on Thursday, September 19, 2013 , 12:06 . Please do not reply .
If there are any technical questions , please contact via email xxxxxx@yyyyy.zzz

这封电子邮件为我提供了我要求注册的课程及其各自的时间表。我正在编写一个程序来自动获取这些信息并制作一个像这样的表格: 时间表

我刚刚开始编写这个程序,我需要获取类 ( BC****) 的代码及其各自的时间表,以便我绘制表格。

我该怎么做?

4

1 回答 1

1

根据新行拆分行,尽管这似乎是 awk 的工作!但是在python中

lst = text.split("\n")
#lst is of type list
for line in lst:
    if lst[:2] == "BC":
        #tadah, you know this line contains what you want do some magic

一个警告,可能是在 BC 部分之前有一些空间,所以把多余的空间撕掉

于 2013-10-20T03:41:47.250 回答