Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. a=open("output.txt","w")
  2.  
  3. for i in range(1,num_lines+1): #num_lines are the number of lines in the file
  4. read=linecache.getline('file.txt',i).rstrip('n') #reads line by line from a text file
  5. splitted=read.split() #splits the string "read"
  6.  
  7. for k in range(i+1,num_lines+1):
  8. read1=linecache.getline('just_nodes.txt',k).rstrip('n')
  9. splitted1=read1.split()
  10.  
  11. alpha_temp=abs(float(splitted[1])-float(splitted1[1])) #heavy step
  12.  
  13. alpha=round(alpha_temp,3)
  14.  
  15. if (alpha==1.000):
  16. a.write(str(splitted1[0]) +' '+ str(splitted[0]) + "n")
  17. a.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement