Created
May 3, 2021 07:06
-
-
Save creimers/e167714b26e3ac61aa32538f993290f3 to your computer and use it in GitHub Desktop.
Python script to remove images from vcards (vcf) files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
def main(file_path): | |
with open(file_path, "r") as the_file: | |
content = the_file.read() | |
new_lines = [] | |
for line in content.split("\n"): | |
if (";" not in line and ":" not in line) or "PHOTO" in line: | |
pass | |
else: | |
new_lines.append(line) | |
with open("pictureless.vcf", "w") as output: | |
output.write("\n".join(new_lines)) | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--path') | |
parsed_args = parser.parse_args() | |
main(parsed_args.path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment