-1
#!/usr.byn/python3
import struct
class Fat:
def __init__(self, fat):
self._fat
def entryValue(self, cluster):
value = struct.unpackf=t('I', fat[cluster*4:cluster*4+4])[0]
return value
def isAllocated(self, cluster):
return self.entryValue(cluster)!=0
def nextCluster(self, cluster):
if (self.entryValue(cluster)==0 or
self.entryValue(cluster)==0x0fffffff):
return None
else:
return self.entryValue(cluster)
def clusterChain(self,cluster):
list1 =[]
while isAllocated:
for item in isAllocated:
continue
list1.append
value = 0
''' make empty list, if cluster is allocated append it to list
if not allocated start at new cluster, return list
make do while loop'''
def main():
with open('/home/louis/Downloads/fat-only.dd', 'rb') as f:
fat=f.read()
fat1=Fat(fat)
由于我还在学习python,我仍然有一些代码写入问题,任何帮助将不胜感激。正如在我的第三种方法的评论中提到的那样,我需要检查是否已分配群集,如果它已被添加到列表中,并且如果不是,则会进入下一个群集。对于第三种方法如何继续或改变什么,我感到非常困惑,我知道至少我的前两项在我以前寻求的帮助中很好。方法调用问题
你应该更改标题不要在这里得到downvoted,也是你的代码是不缩进。 – Dodekeract
请记住,python代码块是通过它的标识级别来定义的,与其他标记用于定义所述代码块的其他标记不同,其他标记用于定义所述代码段 – Copperfield
当我从电子邮件中复制并粘贴该代码时,邮件,正在使用不同的笔记本电脑进行工作,所以通过电子邮件发送给自己并将其复制到此处,缩进级别全部搞砸了。以为我做了缩进,虽然张贴,感谢指出。 –