{"id":44566833,"url":"https://github.com/savirsingh/pytocpp","last_synced_at":"2026-02-14T01:06:24.708Z","repository":{"id":56760551,"uuid":"524765798","full_name":"savirsingh/pytocpp","owner":"savirsingh","description":"Convert Python Code To C++ Code","archived":false,"fork":false,"pushed_at":"2023-04-11T22:27:48.000Z","size":142,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-11T09:25:49.056Z","etag":null,"topics":["cpp","python","pytocpp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/savirsingh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-14T19:50:24.000Z","updated_at":"2024-04-24T13:22:24.000Z","dependencies_parsed_at":"2022-08-16T02:00:41.493Z","dependency_job_id":null,"html_url":"https://github.com/savirsingh/pytocpp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/savirsingh/pytocpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savirsingh%2Fpytocpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savirsingh%2Fpytocpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savirsingh%2Fpytocpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savirsingh%2Fpytocpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/savirsingh","download_url":"https://codeload.github.com/savirsingh/pytocpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savirsingh%2Fpytocpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29427777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T22:20:51.549Z","status":"ssl_error","status_checked_at":"2026-02-13T22:20:49.838Z","response_time":78,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","python","pytocpp"],"created_at":"2026-02-14T01:06:24.247Z","updated_at":"2026-02-14T01:06:24.691Z","avatar_url":"https://github.com/savirsingh.png","language":"Python","readme":"# Py To CPP\n## Convert Python Code To C++\n\n![logo](https://user-images.githubusercontent.com/84334654/184727184-4c00ace5-46c1-4527-b081-ebf60692dc8b.png)\n\nPy To CPP searches files for Python-unique syntax and converts it to the C++ equivalent. \n\nClone the repository:\n```\ngit clone https://github.com/savirsingh/pytocpp\n```\nGo to the directory and start up the conversion script:\n```\npython convert.py\n```\n\n#### There may be some bugs, and this project certainly isn't ready for professional use. It can be helpful for testing, personal use, and competitive programming, since it can generate large C++ files in seconds based on your Python code.\n\n### Status:\n| Statements/Syntax  | Status |\n| ------------- | ------------- |\n| If/Else If/Else  | ✅ |\n| For Loops | ✅ |\n| While Loops | ✅ |\n| Print Statements | ✅ |\n| Input (int/str) | ✅ |\n| Variable Assignments (int/str/bool) | ✅ |\n| Format Conversions | ✅ |\n| Single Line Comments | ✅ |\n| Multiline Comments | ❌ |\n\nFeel free to contribute and add/improve any of these features. \n\nMy email address is kopichiki@gmail.com if you need it.\n\n### Keep these things in mind:\n- Don't use unnecessary brackets in your output/print statement.\n\n  #### DO NOT code like this (❌):\n  ```\n  a = 100\n  b = 10\n\n  for i in range(10):\n    print((a+b)*10)\n  ```\n  #### Code like this (✅):\n  ```\n  a = 100\n  b = 10\n  c = a+b\n  \n  for i in range(10):\n    print(c*10)\n  ```\n- Don't rely entirely on Py To CPP.\n  \n  #### It's important to have some C++ skills, even when using this automated converter. It will help you debug potential issues and/or optimization opportunities for   very large script conversions.\n  \n### Take a look at the examples included in this repository (both Python and C++).\n\n## What it can do (in depth):\n- Convert print statements to std::cout (by simply replacing \"print(\" with \"cout \u003c\u003c \" and replacing \")\" with either \" \u003c\u003c endl;\" or another string of your choice).\n- Convert both string inputs and integer inputs to std::cin (through removal of \" = input()\" and addition of \" \u003e\u003e cin\").\n- Convert for loops by replacing relevant syntax and adding \"}\" to the next unindented line.\n- Convert lists to std::vector by (inefficiently) analysing list's contents (int/str).\n- Convert integers to strings and vice versa by detecting and replacing the relevant syntax if \"input\" is not present in the line.\n- Convert pass statements to \";\" (by literally finding \"pass\" and changing it to \";\").\n- Output new C++ file contents in shell window.\n- Ask to save C++ file (.cpp) in the same directory.\n- Check if files actually exist in directory, if not, return an error and restart.\n\nThe main conversion script is [convert.py](https://github.com/savirsingh/pytocpp/blob/main/convert.py) and the main C++ starter template (boilerplate) the code currently uses is [template.cpp](https://github.com/savirsingh/pytocpp/blob/main/template.cpp).\n\nThank you for spending the time to look at my repository. I hope it benefits you and you learn something new from it! I feel it's pretty amazing that I was able to make this without using any artificial intelligence packages (I didn't want it to have any dependencies).\n\nI must admit, I will be using this in future!\n\n- Savir Singh (kopichiki@gmail.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavirsingh%2Fpytocpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsavirsingh%2Fpytocpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavirsingh%2Fpytocpp/lists"}