Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is a test to evaluate your HTML and basic python skills. Take your time - you are free to ask people about how some bits work.
- Situation:
- The company is developing a HTML <table> generator. Your job is to make a class for this <table> generator.
- Example input:
- studentid.txt
- Student Name, Student ID, Email, Country;
- Alice, 555, rihbo@fjnfw.com, Hong Kong;
- Billy, 52266, uih@uhfuewinf.com, America;
- Wheatley, 3.14, nyan@cat.com, Space
- The first line is the header - it defines what fields are there.
- The numbers of
- Handling erroneous output:
- If the row has less items than the header: fill the missing items with a space ( )
- If the row has more items than the header: raise a ValueError with the message "Too many values in row, content was {ROWCONTENT}"
- Expected output: (All the results should be aligned center, this effect is not shown in the following output)
- Please output the result as raw, complete HTML.
- No title is necessary.
- ================= START OF EXPECTED OUTPUT =================
- studentid.txt <- Header 1, Aligned center, Bold, Underline
- -------------------------------------------------------------
- | Student Name | Student ID | Email | Country |
- -------------------------------------------------------------
- | Alice | 555 | rihbo@fjnfw.com | Hong Kong |
- -------------------------------------------------------------
- | Billy | 52266 | uih@uhfuewinf.com | America |
- -------------------------------------------------------------
- | Wheatley | 3.14 | nyan@cat.com | Space |
- -------------------------------------------------------------
- Size of file: FILESIZEHERE
- MD5 Checksum of file: MD5CHECKSUMHERE
- ================== END OF EXPECTED OUTPUT ==================
- All functions inside the generator class must be well-documented, including usage, parameters, and expected return result.
- Hints:
- How to get MD5 Checksum of a file:
- import hashlib
- def md5file(filename):
- md5 = hashlib.md5()
- with open(filename, 'rb') as f:
- for chunk in iter(lambda: f.read(8192), ''):
- md5.update(chunk)
- return md5.digest()
Add Comment
Please, Sign In to add comment