Question: I have a dict of following format:

```
 d[1][2]= 0.3
 d[1][3] = 0.4
 d[2][8] = 0.2
 d[id1][id2] = value

```

I want to reverse sort this by value?

My logic is very verbose and I have a feeling that it can be done very quickly in python?

Answer: 
Replace `\r` by `""\r`, using extended search mode (you may use `\n` instead of `\r` if your file is in UNIX mode).

To add it on a new line after every line, you can replace `\r\n` by `\r\n""\r\n` (or once again `\n` by `\n""\n` depending on your line ending).
The chosen answer didn't work for me on notepad++ on windows, it simply appended the text at the end of the line. Here's what worked:

1. Open search and replace box, in 'find what' field add '$' (meaning the end of line char)
2. In 'replace with' field use, \r - this will add text after each line
3. Click on replace All button to insert the new line.

![Check the screenshot of the above steps](https://i.stack.imgur.com/HKhGz.png)