시작하기무료로 시작하기

Flying home

Your boss assigned you to a small project. They are performing an analysis of the travels people made to attend business meetings. You are given a dataset with only the email subjects for each of the people traveling.

You learn that the text followed a pattern. Here is an example:

Here you have your boarding pass LA4214 AER-CDB 06NOV.

You need to extract the information about the flight:

  • The two letters indicate the airline (e.g LA),
  • The 4 numbers are the flight number (e.g. 4214).
  • The three letters correspond to the departure (e.g AER),
  • The destination (CDB),
  • The date (06NOV) of the flight.

All letters are always uppercase.

The variable flight containing one email subject was loaded in your session. You can use print() to view it in the IPython Shell.

이 연습은 강의의 일부입니다

Regular Expressions in Python

강의 보기

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Import re
____
코드 편집 및 실행