Python Forum
.Set - Unable to understand the statement
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.Set - Unable to understand the statement
#1
I have the following code which I have inherited it from someone else.
vocab_filename = 'vocab.txt'
vocab = load_doc(vocab_filename)
vocab = vocab.split()
vocab = set(vocab)
I know in the steps above: document gets loaded into the memory
(vocab = load_doc(vocab_filename)
, split into words
vocab = vocab.split()
but I do not follow what this last line is actually doing;

vocab = set(vocab)
Can someone help me understand what the above line does?

Thanks a lot, in advance
Reply


Messages In This Thread
.Set - Unable to understand the statement - by ateestructural - Aug-02-2020, 01:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to understand the meaning of the line of code. jahuja73 0 461 Jan-23-2024, 05:09 AM
Last Post: jahuja73
  Unable to understand how given code takes a fixed input value, without inputting. jahuja73 4 2,892 Jan-28-2021, 05:22 PM
Last Post: snippsat
  Unable to understand a statement in an existing code ateestructural 1 2,349 Aug-01-2020, 09:38 PM
Last Post: deanhystad
  I don't understand this return statement 357mag 4 2,910 Jul-10-2019, 07:02 PM
Last Post: perfringo
  if conditional not firing - unable to understand why simms7400 7 3,590 Oct-20-2018, 12:13 PM
Last Post: stullis
  I don't understand the parameters in a statement that uses the sh library RedSkeleton007 1 2,746 Apr-11-2018, 07:55 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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