Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lists-compare lists
#3
i would like The output to be "One shape" instead of "Not one shape" basically i want to compare the 1st list(1st set) with the 2nd list (2nd set),2nd list (1st set) to 3rd list (2nd set ) and so on.
import dxfgrabber
import math

dwg = dxfgrabber.readfile("test.dxf")
print("DXF version:{} ".format(dwg.dxfversion))
all_lines = [entity for entity in dwg.entities if entity.dxftype=='LINE']

for line in all_lines:
    start=line.start
    #for i in start:
        #print i
    print start
    print start[0]
    end=line.end
    #for n in end:
        #print n
    print end
    print end[0]
    if cmp(start,end)==0:
        print "One shape"
    else:
        print "Not one shape"
    #start_deff=end[0]-start[0]
    #end_deff=end[1]-start[1]
    #print math.sqrt(start_deff**2+end_deff**2)#
Output:
DXF version:AC1024  (1.586566659262402, 8.156562005030274, 0.0) 1.58656665926 (3.041123276594333, 11.37341563410535, 0.0) 3.04112327659 Not one shape (3.041123276594333, 11.37341563410535, 0.0) 3.04112327659 (7.550248640806287, 11.37341563410535, 0.0) 7.55024864081 Not one shape (7.550248640806287, 11.37341563410535, 0.0) 7.55024864081 (7.550248640806287, 9.9829047026913, 0.0) 7.55024864081 Not one shape (7.550248640806287, 9.9829047026913, 0.0) 7.55024864081 (8.277526949472247, 9.54707293644433, 0.0) 8.27752694947 Not one shape (8.277526949472247, 9.54707293644433, 0.0) 8.27752694947 (1.586566659262402, 8.156562005030274, 0.0) 1.58656665926 Not one shape
Reply


Messages In This Thread
Lists-compare lists - by elhetch - Mar-01-2017, 11:07 AM
RE: Lists-compare lists - by buran - Mar-01-2017, 11:10 AM
RE: Lists-compare lists - by elhetch - Mar-01-2017, 11:28 AM
RE: Lists-compare lists - by snippsat - Mar-01-2017, 11:46 AM
RE: Lists-compare lists - by elhetch - Mar-01-2017, 12:15 PM
RE: Lists-compare lists - by Larz60+ - Mar-01-2017, 12:27 PM
RE: Lists-compare lists - by snippsat - Mar-01-2017, 02:26 PM
RE: Lists-compare lists - by buran - Mar-01-2017, 02:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Using Lists as Dictionary Values bfallert 8 473 Apr-21-2024, 06:55 AM
Last Post: Pedroski55
  problem with print lists MarekGwozdz 4 777 Dec-15-2023, 09:13 AM
Last Post: Pedroski55
  python convert multiple files to multiple lists MCL169 6 1,675 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  Lists blake7 6 863 Oct-06-2023, 12:46 PM
Last Post: buran
  Trying to understand strings and lists of strings Konstantin23 2 837 Aug-06-2023, 11:42 AM
Last Post: deanhystad
  Why do the lists not match? Alexeyk2007 3 885 Jul-01-2023, 09:19 PM
Last Post: ICanIBB
  ''.join and start:stop:step notation for lists ringgeest11 2 2,484 Jun-24-2023, 06:09 AM
Last Post: ferdnyc
  Need help with sorting lists as a beginner Realist1c 1 793 Apr-25-2023, 04:32 AM
Last Post: deanhystad
  Pip lists the module but python does not find it Dato 2 1,341 Apr-13-2023, 06:40 AM
Last Post: Dato
  Generate lists of devices and partitions from /proc/partitions? DachshundDigital 1 800 Feb-28-2023, 10:55 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020