Question: My problem is when i insert numbers it works however if i want to insert in the middle it gets inserted but doesnt print the next nodes i dont know if it deletes them or doesnt have access to them.

```
struct node {
    int data ;
    struct node *prev;
    struct node *next;
};

struct node* head = NULL;

```

here is the function insert which has the problem.

```
void insert(int key) {
    struct node *pred=head, *succ;
    struct node *temp2, *temp;
    if (head==NULL) {
        head = (struct node *) malloc(sizeof(struct node));
        head->data = key;
        head->prev = NULL;
        head->next = NULL;
    } else {
        temp2 = (struct node*) malloc(sizeof(struct node));
        temp2->data =  key;
        temp = head;
        while(temp->next!=NULL && temp->next->data < key) {
            pred= temp->next;
            temp = temp->next;
        }
        printf("******pred : %d \n",pred->data);
        //printf("******temp-next %d \n",temp->next->data);
        if (temp->data < key) {
            temp->next = temp->next->next;
            temp->next = temp2;
            temp2->prev = temp;
            temp2->next = pred->next->next;
        } else {     
            //temp2->next= temp;
            //temp->prev = NULL; 
            temp2->next = head;
            //head->prev = temp2;
            head = temp2;
            printf("**** temp : %d",temp->data);
            printf("**** temp2 : %d",temp2->data);
            printf("here\n");
            //temp = temp2 ->prev;
            //temp->prev = NULL;        
        }           
    }
}

```

Answer: 
`rawData = yaml.safe_load(f)` reads the file, and that means the later `yaml.load(f)` can't read any more data from the file. While you could rewind the seek pointer, there is absolutely no reason to: You've already loaded the YAML document (in a manner that is safer, too). Just do `testObj.__dict__ = rawData`.

That said, I have reservations about assigning to `__dict__`. It may or may not be implementation-defined, and in any case it reeks of a hack. There's zero validation, invalid data leads to a type error or attribute error (or with `YAML.load` instead of `safe_load`, even arbitrary other errors, including silent security breaches) later on in the program with no indication that the YAML file is at fault. A proper serialization library is a more robust and maintainable choice in the long run.
Not sure exactly what you are trying to do... Take a look at <http://pyyaml.org/wiki/PyYAMLDocumentation> about halfway down on the section on Constructors, Representers, Resolvers. If you really want your object to be able to be loaded, you want to create a SafeRepresenter and SafeConstructor for it.