Write a function analyze_file(content) that takes a string representing file content and returns a dictionary with file statistics.
Your function should return a dictionary with these keys:
"lines": Total number of lines"words": Total word count"chars": Total character count (excluding newlines)"avg_line_length": Average characters per line (rounded to 1 decimal)Use split('\n') to get lines, then split() on each line for words. For average, divide total chars by number of lines and use round(value, 1).
Write a function parse_logs(log_content, level) that parses log file content and returns entries matching a specific log level.
Each log line follows this format:
Example:
timestamp, level, messageSplit by newlines, then for each line: extract timestamp between brackets, find level before the colon, and the message after the colon. Use .upper() for case-insensitive comparison.
Write a function merge_configs(base_config, override_config) that merges two configuration file contents. The override config takes precedence for duplicate keys.
Each config is in key=value format, one per line:
# are comments (ignore)Create a helper function to parse a single config into a dict. Use line.startswith('#') to detect comments. Parse base first, then update with override using dict.update().