Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- def get_file_encoding(src_file_path):
- """
- Get the encoding type of a file
- :param src_file_path: file path
- :return: str - file encoding type
- """
- with open(src_file_path) as src_file:
- return src_file.encoding
- file_path = input('Please enter file path: ')
- start_time = time.perf_counter()
- print(get_file_encoding(file_path))
- print('get file encoding: {}'.format(time.perf_counter() - start_time))
Advertisement
Add Comment
Please, Sign In to add comment