Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

pytocs

> 编程语言
Open source

Converts Python source to C#

589 stars0 likes0 views
WebsiteGitHub

About

Converts Python source to C#

pytocs

Converts Python source to C#

pytocs is a command line tool I wrote as a hobby project to convert Python source code to C#. I've uploaded it here in case someone finds it useful.

How to run pytocs

Just git clone the project, and use Visual Studio or MSBuild to compile the pytocs.sln file. If you're unable or unwilling to build pytocs from source, the latest continuous integration build is available at appveyor.com.

Examples

To convert a Python file, hand it to pytocs:

pytocs foo.py

To convert all files in a directory (recursively), use the -r parameter:

pytocs -r 

The following python fragment:

python
# Some code below
def hello():
   print "Hello World";

Translates to:

csharp
public static class hello {

    public static object hello() {
	    Console.WriteLine("Hello World");
    }
}

A more ambitious sample:

…

Translates to:

…

Roadmap

The next big items on the list are:

  • Take the types that are inferred and apply them to the code to get away from everything being object.
  • Place local variable declarations at the statement that dominates all definitions of said variables.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#csharppythontranspiler

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言