- Learning Python for Forensics
- Preston Miller Chapin Bryce
- 170字
- 2021-08-20 10:17:10
Developing the print_output() function
The print_output() function defined on line 71 allows us to control how the data is displayed to the user. This function requires two strings as input that represent the USB name and date, as defined by the docstring. On line 78 and 79, we print the USB data using the .format() method. As discussed in Chapter 1, Now for Something Completely Different, this function replaces the curly brackets ({}) with the data provided in the method call. A simple example like this doesn't show off the full power of the .format() method. However, this function can allow us to perform complex string formatting with ease. After printing the input, execution returns to the called function where the script continues the next iteration of the loop, as follows:
071 def print_output(usb_name, usb_date):
072 """
073 Print the information discovered
074 :param usb_name: String USB Name to print
075 :param usb_date: String USB Date to print
076 :return: None
077 """
078 print('Device: {}'.format(usb_name))
079 print('First Install: {}'.format(usb_date))
推薦閱讀
- 信息安全導(dǎo)論(在線實驗+在線自測)
- 數(shù)字身份與元宇宙信任治理
- 腦洞大開:滲透測試另類實戰(zhàn)攻略
- 白帽子講Web安全(紀(jì)念版)
- INSTANT Windows PowerShell
- 模糊測試:強制發(fā)掘安全漏洞的利器
- ARM匯編與逆向工程:藍(lán)狐卷·基礎(chǔ)知識
- 黑客攻防與網(wǎng)絡(luò)安全從新手到高手(絕招篇)
- 信息安全等級保護測評與整改指導(dǎo)手冊
- CTF那些事兒
- SQL Injection Strategies
- 電腦安全與攻防入門很輕松(實戰(zhàn)超值版)
- Mastering Python for Networking and Security
- 復(fù)雜信息系統(tǒng)網(wǎng)絡(luò)安全體系建設(shè)指南
- Practical Internet of Things Security