我是Python新手并尝试将程序从Java迁移到Python。 在这个应用程序中,我将读取一个文本文件,并将根据记录类型处理数据。 每个记录存储一个金额值为12个字符,即22.10将存储为000000002210。
在Java中,我会执行以下操作将000000002210转换为22.10
class Pitch_Class_Set(object):
def __init__(self, pitches):
self.pitches = pitches
print(self.pitches)
print(list(set([int(i) % 12 for i in self.pitches.split()])).sort())
setterino = Pitch_Class_Set(input('> '))
任何人都可以帮助我使用Python做同样的事情。
请注意,我在Windows 7中使用Python2.7。