This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colon=":" | |
count=0 | |
total=0 | |
fname = raw_input("Enter file name: ") | |
fh = open(fname) | |
for line in fh: | |
if not line.startswith("X-DSPAM-Confidence:") : continue | |
pos = line.find(colon) | |
pos=int(pos) | |
num=line[pos+1:40] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
largest = -1 | |
print "Before", largest | |
for value in [3,41,12,9,74,15] : | |
if value > largest : | |
largest = value | |
print largest,value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = "mbox-short.txt" # the name of the file with the text source | |
handle = open(name) # "store" the file temporally into a handle variable | |
cou=dict() # defines a dictionary named cou | |
correos=list() # defines a list called correos | |
#correos create a list with every mail address | |
for line in handle: # check for every line of the file with text | |
if not line.startswith("From:") : continue # if the line don´t start with "From:" pass to the next line | |
words=line.split() # else store the line in the list named words with every component | |
# separated by a space splitted as a different ellement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = "mbox-short.txt" | |
handle = open(name) | |
dic=dict() # defines an empty dictionary | |
for line in handle: | |
if not line.startswith("From ") : continue #select only lines with "From " | |
words=line.split() #turns string into list of words | |
word2=words[5] #select hour | |
word2=word2[:2] #slice 2 first characters | |
dic[word2]=dic.get(word2,0)+1 #accumulate in dictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fname = raw_input("Enter file name: ") | |
fh = open(fname) | |
lst = list() # list for the desired output | |
for line in fh: # to read every line of file romeo.txt | |
word= line.rstrip().split() # to eliminate the unwanted blanks and turn the line into a list of words | |
for element in word: # check every element in word | |
if element in lst: # if element is repeated | |
continue # do nothing | |
else : # else if element is not in the list | |
lst.append(element) # append |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub tdolares_Exit(ByVal Cancel As MSForms.ReturnBoolean) | |
tpesos.text = Val(tdolares.text) * 500 | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub tpesos_Exit(ByVal Cancel As MSForms.ReturnBoolean) | |
tdolares.text = Val(tpesos.text) /500 | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub CommandButton1_Click() | |
tdolares.Text = “” | |
tpesos.Text = “” | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub CommandButton1_Click() | |
tdolares.Text = “” | |
tpesos.Text = “” | |
End Sub | |
Private Sub tdolares_Change() | |
End Sub | |
Private Sub tdolares_Exit(ByVal Cancel As MSForms.ReturnBoolean) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub prueba1() | |
UserForm1.show | |
End Sub |
OlderNewer