Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a=['questo e un testo con stile', [0, 2,"bold"], [5,8, "italics"]] #true
- b=['questo e un testo con stile', [0, 2,"bold"], [5,8, "BLAAAAAAAA"]] #true perchè nel b[1][2] c'è il 'blond' e quindi
- #tra 0 e 2 il testo è di formato blond
- c=['questo e un testo con stile', [0, 2], [5,8,"italics"]] #false
- d= ['questo e un testo con stile', [0, "bold"], [5,8,"italics"]] #false
- e= [[0, 3, "bold"], [5,8,"italics"]] #false
- def check_of_format(textList):
- #@ param textList : list
- if isinstance ( textList , list) == false:
- showInformation("il formato non e' un testo con stile")
- return false
- elif isinstance (textList[0] , str ) == false :
- showInformation("il formato non e' un testo con stile")
- return false
- for i in range(1 , len(textList)):
- if len(textList[i]) == 3:
- check1= isinstance(textList[i][0] , int)
- check2= isinstance(textList[i][1] , int)
- check3= isinstance(textList[i][2] , str)
- else:
- showInformation("il formato non e' un testo con stile")
- return false
- if(check1 and check2 and check3):
- checkFormat1= 'italics' in textList[1][2]
- checkFormat2= 'plain' in textList[1][2]
- checkFormat3= 'bold' in textList[1][2]
- checkFormat4= 'underlined' in textList[1][2]
- if checkFormat1 or checkFormat2 or checkFormat3 or checkFormat4 :
- showInformation("il formato e' un testo con stile")
- return true
- else :
- showInformation("il formato non e' un testo con stile")
- return false
- else :
- return false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement