Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filename='dane.txt'
- mylist=[]
- counter=0
- with open(filename) as file:
- for line in file:
- line=line.split(' ')
- for i in range(len(line)):
- line[i]=int(line[i])
- mylist.append(line)
- for i in range(200):
- for j in range(320):
- stop=0
- try:
- if mylist[i][j]-mylist[i+1][j]>128 or mylist[i][j]-mylist[i+1][j]<-128:
- counter=counter+1
- stop=1
- except:
- pass
- if stop==0:
- try:
- if mylist[i][j] - mylist[i-1][j] > 128 or mylist[i][j] - mylist[i - 1][j] < -128:
- counter = counter + 1
- stop = 1
- except:
- pass
- if stop==0:
- try:
- if mylist[i][j] - mylist[i][j+1] > 128 or mylist[i][j] - mylist[i][j+1] < -128:
- counter = counter + 1
- stop = 1
- except:
- pass
- if stop==0:
- try:
- if mylist[i][j] - mylist[i][j-1] > 128 or mylist[i][j] - mylist[i][j-1] < -128:
- counter = counter + 1
- stop = 1
- except:
- pass
- print(counter)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement