0

I have a small issue with PyDictionary; When I enter a list of words, the printing of the words Does NOT keep the order of the word list.

For example:

from PyDictionary import PyDictionary

dictionary=PyDictionary(
"bad ",
"omen",
"azure ",
"sky",
"icy ",
"smile")

print(dictionary.printMeanings())

This list will print first Omen, Then Sky and so on, What I need is to print the word list in its original order. I search on google but there was nothing related, I search the posts in this forum and nothing. I hope you can help me. Thank you in advance.

ThePyGuy
  • 17,779
  • 5
  • 18
  • 45
  • Which version of Python are you using? It works just fine and maintains the order on my end. The reason could probably be because of the older version of Python where the orders of the dictionary items are not preserved. – ThePyGuy Jun 28 '21 at 03:07
  • Hi, I am using python 2.7 in an old laptop, If I try to use python 3.9 it does not output anything it just stays Blinking. – user16330615 Jun 28 '21 at 03:23
  • I tested on Python 3.7.5 and it just works fine. – ThePyGuy Jun 28 '21 at 03:24
  • 1
    Great to know, I will try to install that version. One problem was that when I try to install PyDictionary on any python 3 version it get me errors, I'll give it a try and let you know. Thank you for the help. – user16330615 Jun 28 '21 at 03:27
  • According to PyDictionary's documentation it supports Python 3 so whatever problem you had installing it, that is not it. Python `dict`s were unordered by definition until Python 3.7 so you can't do what you want with 2.7. – BoarGules Jun 28 '21 at 08:47

1 Answers1

0

I found a workaround that gives me a full solution to my initial printing issues.

The Main Problem is that I am using an OLD laptop (older than 12 years), So I have Not been able to use python 3+, Using PyDictionary with python 2.7 arouse the problem of printing the initial word list randomly.

The Solution is to print a single word for each printing, BUT I have to do this about 25,000 times!... Using Notepad++ I made a macro that codes each word to be used with python, Furthermore I was able to even add the Spanish translation to each English word, The printing of each word individually added the benefit that each word definitions are separated from each word.

Using Notepad++ and regex I am able to do the final clean up of each word, and it's meaning.

So I am happy with this workaround... Thank You for your help.

  • You should still be able to use python3 on your laptop, and I strongly recommend doing so. Try on your own first, but if you get stuck you can ask for help. – Ezra Jun 28 '21 at 18:03