Re: [Tutor] Find (list) strings in large textfile

2017-02-09 Thread Alan Gauld via Tutor
On 09/02/17 19:15, Sylwester Graczyk wrote: > Hi all, > I'm try to write a code to search strings (from one textfile with lists > of strings) in second large text file. > but script doesn't search my lists in entire file (not complete output file) The problem is that you open the data file once,

Re: [Tutor] Find (list) strings in large textfile

2017-02-09 Thread Danny Yoo
Files don't rewind automatically, so once a loop goes through the file once, subsequent attempts will finish immediately. We might fix this by "seek", which will let us rewind files. However, your data is large enough that you might want to consider efficiency too. The nested loop approach is go

[Tutor] Find (list) strings in large textfile

2017-02-09 Thread Sylwester Graczyk
Hi all, I'm try to write a code to search strings (from one textfile with lists of strings) in second large text file. but script doesn't search my lists in entire file (not complete output file) *[list_life.txt]* 1654 964563 41164 6165456 85248 999745 35496486 ... +2000 row's *[large_file.txt

Re: [Tutor] Help with Multiple Inheritance in Classes

2017-02-09 Thread Alan Gauld via Tutor
On 09/02/17 10:42, Vusa Moyo wrote: > Thanks so much. You've been a great help. > > You have confirmed that the lecture's question is flawed. It is not, it is exactly right. (Albeit unusual in its use of class attributes) but there is nothing wrong with the code, only the way you were trying to u

Re: [Tutor] Help with Multiple Inheritance in Classes

2017-02-09 Thread Vusa Moyo
Thanks so much. You've been a great help. You have confirmed that the lecture's question is flawed. Appreciate the help. Regards Vusa On Thu, Feb 9, 2017 at 12:02 PM, Alan Gauld via Tutor wrote: > On 09/02/17 09:25, Vusa Moyo wrote: > > > class Cat: > > name = "" > > kind = "cat" > >

Re: [Tutor] Help with Multiple Inheritance in Classes

2017-02-09 Thread Alan Gauld via Tutor
On 09/02/17 09:25, Vusa Moyo wrote: > class Cat: > name = "" > kind = "cat" > color = "" > value = 100.00 > > def description(self): > desc_str = "%s is a %s %s cat worth R%.2f." % (self.name, > self.color, self.kind, self.value) > return desc_str > > The abov

Re: [Tutor] Help with Multiple Inheritance in Classes

2017-02-09 Thread Vusa Moyo
Hi Alan. You are correct with the indentation. class Cat: name = "" kind = "cat" color = "" value = 100.00 def description(self): desc_str = "%s is a %s %s cat worth R%.2f." % (self.name, self.color, self.kind, self.value) return desc_str The above code is th

Re: [Tutor] Help on this assignment

2017-02-09 Thread Alan Gauld via Tutor
On 09/02/17 08:10, Sasiliyu Adetunji wrote: > Write a function called remove_duplicates which will take one argument > called string. This string input will only have characters between a-z. > > The function should remove all repeated characters in the string and return > a tuple with two values:

[Tutor] Help on this assignment

2017-02-09 Thread Sasiliyu Adetunji
Please can you assist me in this assignment Write a function called remove_duplicates which will take one argument called string. This string input will only have characters between a-z. The function should remove all repeated characters in the string and return a tuple with two values: A new s