Question: perl to python translation I am translating a couple pieces of code from perl to python and well this one has me guessing my self

perl to python translation I am translating a couple pieces of code from perl to python and well this one has me guessing my self so I need some help here. PERL CODE open(F, $groupsFile) || die "Can't open groups file '$groupsFile' "; my %groups; while() { chomp; my @a = split(/\s/); my $groupId = shift(@a); my @b = sort(@a); my $sortedMembers = join(" ", @b); $groups{$sortedMembers} = $groupId; } foreach my $grp (sort(keys(%groups))) { print "$groups{$grp} $grp " PYTHON TRANSLATION if(len(sys.argv) = 1 groupFile = sys.arg[0] IN = (groupFile -r) groups = { } for line in IN: IN.line.splt arr1 =[] # line splt sort #groupID = aa2 = [] # sort array 1 # "sorted memebers" join lines in array with a space between # array groups[sortedmemebers] == array group D

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!