Python #ifdef

88888 Dihedral dihedral88888 at gmail.com
Tue May 28 19:04:25 EDT 2013


Carlos Nepomuceno於 2013年5月29日星期三UTC+8上午3時46分37秒寫道:
> Are there Python 'preprocessor directives'?
> 
> I'd like to have something like '#ifdef' to mix code from Python 2 and 3 in a single file.
> 
> Is that possible? How?

Use execfile(filename) at the beginning to get what you want.
The .pyc version is preferred.



More information about the Python-list mailing list