Question: I am trying to write some code that takes an input file which is a paragraph of text(this paragraph has duplicates of certain words), I then want to write this text to an output file, however I do not want the duplicates of the words written to my output file, just unique words, this includes one copy of the duplicates. 

This is as far as I have gotten, I can't seem to figure out how to write only unique words.

```
def unique_file(input_filename, output_filename):

    input_file = open(input_filename,'r')
    content = input_file.read()
    input_file.close()
    word_list = content.split()
    output_file = open(output_filename,'w')

    unique_list = []
        for words in word_list:
            if words not in unique_list:
                output_file.write(words + '\n')
                output_file.close

```

Answer: 
Why should we bother. We can use jquery too.

add jquery 1.10.3 in your code.
and code below in your page where you want dropdownlistfor selected value

write in View part

```
<script  type="text/JavaScript">
   $(document).ready(function () {
     $('#site').val(@Model.site_id);
  });
</script>

@Html.DropDownListFor(model => model.site_id, new SelectList(ViewBag.site_id, "id", "name"), "Select Any", new {@class="form-control",required="required",autofocus="autofocus",id="site" })

```
**C# code:**

```
public class MyClass {
    public int Id { get; set; }
    public string Name { get; set; }
}

var list = new[] {   
    new MyClass { Id = 1, Name = "Name1" }, 
    new MyClass { Id = 2, Name = "Name2" }, 
    new MyClass { Id = 3, Name = "Name3" } 
};

var selectList = new SelectList(list, "Id", "Name", 2);
ViewBag.DDL = selectList;

```

**In View:**

```
@Html.DropDownListFor(model => model.site_id,
                     ViewBag.DDL as SelectList, 
                     "Select Any", 
                     new {@class="form-control",required="required",autofocus="autofocus" })

```

**Html Output:**

```
<select id="site_id" name="site_id" required="required" class="form-control">
    <option value="1">Name1</option>
    <option selected="selected" value="2">Name2</option>
    <option value="3">Name3</option>
</select>

```