Re: [Tutor] Comparing two different text file

2014-07-29 Thread Steven D'Aprano
On Wed, Jul 30, 2014 at 08:13:37AM +0900, 이명교 wrote: > #!/usr/bin/env python > list1 = [] > list2 = [] > list3 = [] > list4 = [] > #imports list from first text file > inf1 = open('first.txt') > for line in inf1.readlines(): > list1.append(line) > list1 = line[:-1].split('\n') Try this:

Re: [Tutor] Comparing two different text file

2014-07-29 Thread Marc Tompkins
On Tue, Jul 29, 2014 at 4:13 PM, 이명교 wrote: > inf1 = open('first.txt') > for line in inf1.readlines(): > list1.append(line) So far, so good... > list1 = line[:-1].split('\n') ...but then you do this, which wipes out list1. > for a in list1: > if a not in list1: Even if you hadn't

[Tutor] Comparing two different text file

2014-07-29 Thread 이명교
Hello I'd like to make new list from 'first.txt' which is not overlapped 'second.txt'. I tried several times but I couldn't find right answer. output was '[]' First, Import two different text file and read as a list. If 'first.txt' has same value as second.txt', don't append to new list. 'first

Re: [Tutor] Read a file, Load a dictionary

2014-07-29 Thread Alan Gauld
On 25/07/14 02:58, Deb Wyatt wrote: assuming you're using version 3.5 How do you get version 3.5? Python.org shows 3.41 as being the latest. You download the source code and build from scratch. Its not really recommended for normal use yet - its still in development. -- Alan G Author