Bu python kodunu otomatik olarak PHP'ye dönüştürebilen bir yazılım dönüştürücü var mı?Python Kodunu PHP'ye Dönüştürme
#!/usr/bin/python
import math
def calcNumEntropyBits(s):
if len(s) <= 0: return 0.0
symCount = {}
for c in s:
if c not in symCount: symCount[c] = 1
else: symCount[c] += 1
entropy = 0.0
for c,n in symCount.iteritems():
prob = n/float(len(s))
entropy += prob * (math.log(prob)/math.log(2))
if entropy >= 0.0: return 0.0
else: return -(entropy*len(s))
def testEntropy(s):
print "Bits of entropy in '%s' is %.2f" % (s, calcNumEntropyBits(s))
testEntropy('hello world')
testEntropy('bubba dubba')
testEntropy('aaaaaaaaaaa')
testEntropy('aaaaabaaaaa')
testEntropy('abcdefghijk')
"Yazılım dönüştürücüsünü" tersine çeviren kullanıcı oldu. –
Ha. Yığın Taşması, PHP kodunu gönderebileceğiniz ve Python'u geri alabileceğiniz bir API yöntemine ihtiyaç duyar! – JAL
@JAL [Universal-transpiler] (https://github.com/jarble/universal-transpiler) PHP programlama dilinin küçük bir alt kümesini Python'a dönüştürebilir. Yine de hala devam eden bir çalışma. –